diff options
author | Robert Griesemer <gri@golang.org> | 2016-09-15 17:40:26 -0700 |
---|---|---|
committer | Robert Griesemer <gri@golang.org> | 2016-09-16 20:58:20 +0000 |
commit | 32db3f2756324616b7c856ac9501deccc2491239 (patch) | |
tree | 28a6afe4150d7cdcda6f06a8abde0ffeb18de267 /src/cmd/compile/internal/syntax/scanner_test.go | |
parent | 28ed2b0cd9ad6e2015f073931c05c08e8bf7b247 (diff) | |
download | go-32db3f2756324616b7c856ac9501deccc2491239.tar.gz go-32db3f2756324616b7c856ac9501deccc2491239.zip |
cmd/compile/internal/syntax: support for alias declarations
Permits parsing of alias declarations with -newparser
const/type/var/func T => p.T
but the compiler will reject it with an error. For now this
also accepts
type T = p.T
so we can experiment with a type-alias only scenario.
- renamed _Arrow token to _Larrow (<-)
- introduced _Rarrow token (=>)
- introduced AliasDecl node
- extended scanner to accept _Rarrow
- extended parser and printer to handle alias declarations
Change-Id: I0170d10a87df8255db9186d466b6fd405228c38e
Reviewed-on: https://go-review.googlesource.com/29355
Run-TryBot: Robert Griesemer <gri@golang.org>
Reviewed-by: Matthew Dempsky <mdempsky@google.com>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Diffstat (limited to 'src/cmd/compile/internal/syntax/scanner_test.go')
-rw-r--r-- | src/cmd/compile/internal/syntax/scanner_test.go | 3 |
1 files changed, 2 insertions, 1 deletions
diff --git a/src/cmd/compile/internal/syntax/scanner_test.go b/src/cmd/compile/internal/syntax/scanner_test.go index 38a7e0da4c..0e0ff1b172 100644 --- a/src/cmd/compile/internal/syntax/scanner_test.go +++ b/src/cmd/compile/internal/syntax/scanner_test.go @@ -210,7 +210,8 @@ var sampleTokens = [...]struct { {_IncOp, "--", Sub, precAdd}, {_Assign, "=", 0, 0}, {_Define, ":=", 0, 0}, - {_Arrow, "<-", 0, 0}, + {_Larrow, "<-", 0, 0}, + {_Rarrow, "=>", 0, 0}, // delimiters {_Lparen, "(", 0, 0}, |