Skip to content

Commit 9428ab9

Browse files
committed
parser: Update from go tool yacc into goyacc
Since Go 1.8 removed the go tool yacc command, we should update it to use goyacc
1 parent ed3c651 commit 9428ab9

File tree

4 files changed

+1437
-1015
lines changed

4 files changed

+1437
-1015
lines changed

parser/grammar_data_test.go

+3
Original file line numberDiff line numberDiff line change
@@ -260,6 +260,9 @@ var grammarTestData = []struct {
260260
{"a, b = *a", "exec", "Module(body=[Assign(targets=[Tuple(elts=[Name(id='a', ctx=Store()), Name(id='b', ctx=Store())], ctx=Store())], value=Starred(value=Name(id='a', ctx=Load()), ctx=Load()))])", nil, ""},
261261
{"a = yield a", "exec", "Module(body=[Assign(targets=[Name(id='a', ctx=Store())], value=Yield(value=Name(id='a', ctx=Load())))])", nil, ""},
262262
{"a.b = 1", "exec", "Module(body=[Assign(targets=[Attribute(value=Name(id='a', ctx=Load()), attr='b', ctx=Store())], value=Num(n=1))])", nil, ""},
263+
{"[e for e in [1, 2, 3]] = 3", "exec", "", py.SyntaxError, "can't assign to list comprehension"},
264+
{"{e for e in [1, 2, 3]} = 3", "exec", "", py.SyntaxError, "can't assign to set comprehension"},
265+
{"{e: e**2 for e in [1, 2, 3]} = 3", "exec", "", py.SyntaxError, "can't assign to dict comprehension"},
263266
{"f() = 1", "exec", "", py.SyntaxError, "can't assign to function call"},
264267
{"lambda: x = 1", "exec", "", py.SyntaxError, "can't assign to lambda"},
265268
{"(a + b) = 1", "exec", "", py.SyntaxError, "can't assign to operator"},

parser/parser.go

+1-1
Original file line numberDiff line numberDiff line change
@@ -7,5 +7,5 @@
77
// % go generate
88
// % go build
99

10-
//go:generate go tool yacc -v y.output grammar.y
10+
//go:generate goyacc -v y.output grammar.y
1111
package parser

0 commit comments

Comments
 (0)