summaryrefslogtreecommitdiff
path: root/src/pkg/exp/eval/compiler.go
diff options
context:
space:
mode:
authorRobert Griesemer <gri@golang.org>2009-12-15 15:27:16 -0800
committerRobert Griesemer <gri@golang.org>2009-12-15 15:27:16 -0800
commit881d6064d23d9da5c7ff368bc7d41d271290deff (patch)
tree44d5d948e3f27cc7eff15ec8cd7ee5165d9a7e90 /src/pkg/exp/eval/compiler.go
parentd9dfea3ebd51cea89fef8afc6b2377c2958b24f1 (diff)
downloadgolang-881d6064d23d9da5c7ff368bc7d41d271290deff.tar.gz
1) Change default gofmt default settings for
parsing and printing to new syntax. Use -oldparser to parse the old syntax, use -oldprinter to print the old syntax. 2) Change default gofmt formatting settings to use tabs for indentation only and to use spaces for alignment. This will make the code alignment insensitive to an editor's tabwidth. Use -spaces=false to use tabs for alignment. 3) Manually changed src/exp/parser/parser_test.go so that it doesn't try to parse the parser's source files using the old syntax (they have new syntax now). 4) gofmt -w src misc test/bench 2nd set of files. R=rsc CC=golang-dev http://codereview.appspot.com/179067
Diffstat (limited to 'src/pkg/exp/eval/compiler.go')
-rw-r--r--src/pkg/exp/eval/compiler.go60
1 files changed, 30 insertions, 30 deletions
diff --git a/src/pkg/exp/eval/compiler.go b/src/pkg/exp/eval/compiler.go
index f349b836f..6bde3b567 100644
--- a/src/pkg/exp/eval/compiler.go
+++ b/src/pkg/exp/eval/compiler.go
@@ -5,14 +5,14 @@
package eval
import (
- "fmt";
- "go/scanner";
- "go/token";
+ "fmt"
+ "go/scanner"
+ "go/token"
)
type positioned interface {
- Pos() token.Position;
+ Pos() token.Position
}
@@ -22,28 +22,28 @@ type positioned interface {
// TODO(austin) This might actually represent package level, in which
// case it should be package compiler.
type compiler struct {
- errors scanner.ErrorHandler;
- numErrors int;
- silentErrors int;
+ errors scanner.ErrorHandler
+ numErrors int
+ silentErrors int
}
func (a *compiler) diagAt(pos positioned, format string, args ...) {
- a.errors.Error(pos.Pos(), fmt.Sprintf(format, args));
- a.numErrors++;
+ a.errors.Error(pos.Pos(), fmt.Sprintf(format, args))
+ a.numErrors++
}
-func (a *compiler) numError() int { return a.numErrors + a.silentErrors }
+func (a *compiler) numError() int { return a.numErrors + a.silentErrors }
// The universal scope
func newUniverse() *Scope {
- sc := &Scope{nil, 0};
+ sc := &Scope{nil, 0}
sc.block = &block{
offset: 0,
scope: sc,
global: true,
defs: make(map[string]Def),
- };
- return sc;
+ }
+ return sc
}
var universe *Scope = newUniverse()
@@ -51,46 +51,46 @@ var universe *Scope = newUniverse()
// TODO(austin) These can all go in stmt.go now
type label struct {
- name string;
- desc string;
+ name string
+ desc string
// The PC goto statements should jump to, or nil if this label
// cannot be goto'd (such as an anonymous for loop label).
- gotoPC *uint;
+ gotoPC *uint
// The PC break statements should jump to, or nil if a break
// statement is invalid.
- breakPC *uint;
+ breakPC *uint
// The PC continue statements should jump to, or nil if a
// continue statement is invalid.
- continuePC *uint;
+ continuePC *uint
// The position where this label was resolved. If it has not
// been resolved yet, an invalid position.
- resolved token.Position;
+ resolved token.Position
// The position where this label was first jumped to.
- used token.Position;
+ used token.Position
}
// A funcCompiler captures information used throughout the compilation
// of a single function body.
type funcCompiler struct {
- *compiler;
- fnType *FuncType;
+ *compiler
+ fnType *FuncType
// Whether the out variables are named. This affects what
// kinds of return statements are legal.
- outVarsNamed bool;
- *codeBuf;
- flow *flowBuf;
- labels map[string]*label;
+ outVarsNamed bool
+ *codeBuf
+ flow *flowBuf
+ labels map[string]*label
}
// A blockCompiler captures information used throughout the compilation
// of a single block within a function.
type blockCompiler struct {
- *funcCompiler;
- block *block;
+ *funcCompiler
+ block *block
// The label of this block, used for finding break and
// continue labels.
- label *label;
+ label *label
// The blockCompiler for the block enclosing this one, or nil
// for a function-level block.
- parent *blockCompiler;
+ parent *blockCompiler
}