I'm trying to use parser.ParseExpr. I'm thinking "var a = 9" is a valid expression, but ParseExpr returns an error:
// simple.go: package main import ( "fmt" "go/parser" ) func main() { ast0, err := parser.ParseExpr("var a = 9") fmt.Printf("err = %v\n", err) fmt.Printf("ast0 = %#v\n", ast0) } $go run simple.go *err = 1**:**1**: *expected operand, found 'var' ast0 = <nil> $ Pedantically, perhaps this is a statement rather than an expression. That begs the question, is there anyway to parse single statements (using go/parse)? -- You received this message because you are subscribed to the Google Groups "golang-nuts" group. To unsubscribe from this group and stop receiving emails from it, send an email to golang-nuts+unsubscr...@googlegroups.com. For more options, visit https://groups.google.com/d/optout.