diff options
author | Robert Griesemer <gri@golang.org> | 2016-03-04 17:09:08 -0800 |
---|---|---|
committer | Matthew Dempsky <mdempsky@google.com> | 2016-08-18 21:33:38 +0000 |
commit | c8683ff7977c526fb48ae007971fed16ef32ff62 (patch) | |
tree | 408437654d4fd529b864b27ff66068f646bde746 /src/cmd/compile/internal/syntax/printer_test.go | |
parent | 3b967be4219c789ef9c47aa5e9607cab3005e1cd (diff) | |
download | go-c8683ff7977c526fb48ae007971fed16ef32ff62.tar.gz go-c8683ff7977c526fb48ae007971fed16ef32ff62.zip |
cmd/compile/internal/syntax: fast Go syntax trees, initial commit.
Syntax tree nodes, scanner, parser, basic printers.
Builds syntax trees for entire Go std lib at a rate of ~1.8M lines/s
in warmed up state (MacMini, 2.3 GHz Intel Core i7, 8GB RAM):
$ go test -run StdLib -fast
parsed 1074617 lines (2832 files) in 579.66364ms (1853863 lines/s)
allocated 282.212Mb (486.854Mb/s)
PASS
Change-Id: Ie26d9a7bf4e5ff07457aedfcc9b89f0eba72ae3f
Reviewed-on: https://go-review.googlesource.com/27195
Run-TryBot: Matthew Dempsky <mdempsky@google.com>
Reviewed-by: Robert Griesemer <gri@golang.org>
Diffstat (limited to 'src/cmd/compile/internal/syntax/printer_test.go')
-rw-r--r-- | src/cmd/compile/internal/syntax/printer_test.go | 24 |
1 files changed, 24 insertions, 0 deletions
diff --git a/src/cmd/compile/internal/syntax/printer_test.go b/src/cmd/compile/internal/syntax/printer_test.go new file mode 100644 index 0000000000..e8c2201e60 --- /dev/null +++ b/src/cmd/compile/internal/syntax/printer_test.go @@ -0,0 +1,24 @@ +// Copyright 2016 The Go Authors. All rights reserved. +// Use of this source code is governed by a BSD-style +// license that can be found in the LICENSE file. + +package syntax + +import ( + "fmt" + "os" + "testing" +) + +func TestPrint(t *testing.T) { + if testing.Short() { + t.Skip("skipping test in short mode") + } + + ast, err := ReadFile(*src, nil, 0) + if err != nil { + t.Fatal(err) + } + Fprint(os.Stdout, ast, true) + fmt.Println() +} |