mattn / anko

Scriptable interpreter written in golang
http://play-anko.appspot.com/
MIT License
1.45k stars 120 forks source link

unknown field 'Structs' in struct literal of type ast.TypeStruct #334

Closed dgrr closed 4 years ago

dgrr commented 4 years ago

In https://github.com/mattn/anko/blob/master/parser/parser.go.y#L693

For some reason it doesn't exist here https://github.com/mattn/anko/blob/master/parser/parser.go#L2022

parser.go.y:693: undefined: ast.TypeStructType
parser.go.y:693: unknown field 'Structs' in struct literal of type ast.TypeStruct
dgrr commented 4 years ago

Would this solve the problem?

vi := &ast.TypeStruct{Kind: ast.TypeStructType} // Structs: $3}
for k, v := range $3 {
  vi.StructNames = append(vi.StructNames, k)
  vi.StructTypes = append(vi.StructTypes, v)
}
$$ = vi
dgrr commented 4 years ago

https://github.com/dgrr/anko/blob/master/parser/parser.go.y#L713

MichaelS11 commented 4 years ago

Not sure why you are getting that error. Have you updated to the latest version? go get -u github.com/mattn/anko

dgrr commented 4 years ago

Well... Structs is not defined in that structure. And yes, I updated

MichaelS11 commented 4 years ago

Sorry, I am not following what the issue is. Do you have a code example of what is not working?

dgrr commented 4 years ago

On anko/parser

dgrr:xs 20:54:52 [master] $ rm parser.go
dgrr:xs 20:54:54 [master x] $ make
goyacc -o parser.go parser.go.y

conflicts: 193 shift/reduce, 211 reduce/reduce
gofmt -s -w .
dgrr:xs 20:54:59 [master !?] $ go build
# github.com/mattn/anko/parser
parser.go.y:693: unknown field 'Structs' in struct literal of type ast.TypeStruct
MichaelS11 commented 4 years ago

You are correct, having same issue

MichaelS11 commented 4 years ago

Looks like I missed uploading some of the parser changes. Working on a fix.

MichaelS11 commented 4 years ago

@dgrr Thank you for finding this.

https://github.com/mattn/anko/pull/335