mattn/anko

unexpected IDENT error in Anko interactive mode

tesujiro opened this issue · 2 comments

The following error occurs in Anko interactive mode.

> if a==1 {
  b=1
  b=2
1:13 syntax error: unexpected IDENT, expecting '}'
>

And can be fixed like this:

diff --git a/anko.go b/anko.go
index f4413d2..5848a68 100644
--- a/anko.go
+++ b/anko.go
@@ -120,6 +120,7 @@ func runInteractive() int {
                        if strings.HasPrefix(es, "syntax error: unexpected") {
                                if strings.HasPrefix(es, "syntax error: unexpected $end,") {
                                        following = true
+                                       source += "\n"
                                        continue
                                }
                        } else {

@MichaelS11
Thank you!