rumlang / rum

Functional language, easily extensible and possible (Lua features with LISP dialect and functional) to be embarked on software Go!
https://www.rumlang.org/
MIT License
157 stars 13 forks source link

playground: panic: strconv.ParseFloat: parsing "3]": invalid syntax #129

Open avelino opened 6 years ago

avelino commented 6 years ago

production crash log:

play_1   | 2018/02/22 00:03:27 New session 764d5a8f-0c6c-4a16-9d0d-4f95aed88fc1
play_1   | 2018/02/22 00:03:27 App Initialize
play_1   | 2018/02/22 00:03:27 AddForm home {{map[]}}
play_1   | 2018/02/22 00:03:27 App goto home
play_1   | 2018/02/22 00:03:27 RumreplForm Initialize
play_1   | 2018/02/22 00:03:34 currentForm = {map[run:0x6cb9e0 clean:0x6cbe90 share:0x6cc070]} msgs = [run]
play_1   | 2018/02/22 00:03:34 http: panic serving 172.18.0.3:48946: runtime error: invalid memory address or nil pointer dereference
play_1   | goroutine 828 [running]:
play_1   | net/http.(*conn).serve.func1(0xc420070820)
play_1   |      /usr/local/go/src/net/http/server.go:1697 +0xd0
play_1   | panic(0x727cc0, 0x964f00)
play_1   |      /usr/local/go/src/runtime/panic.go:491 +0x283
play_1   | github.com/rumlang/playground/forms.runRumRepl(0xc42022cf00, 0xc42010a140, 0xc4201ad310, 0x1, 0x1)
play_1   |      /go/src/github.com/rumlang/playground/forms/home.go:172 +0x2cb
play_1   | github.com/rumlang/playground/vendor/github.com/trumae/valente.FormImpl.Run(0xc420118330, 0xc42022cf00, 0xc42010a140, 0x0, 0x0)
play_1   |      /go/src/github.com/rumlang/playground/vendor/github.com/trumae/valente/valente.go:77 +0x391
play_1   | github.com/rumlang/playground/vendor/github.com/trumae/valente.(*App).Run(0xc42010a140)
play_1   |      /go/src/github.com/rumlang/playground/vendor/github.com/trumae/valente/valente.go:150 +0x6e
play_1   | main.main.func2(0x9380e0, 0xc4201cc1c0, 0xc42013aa00)
play_1   |      /go/src/github.com/rumlang/playground/main.go:141 +0x580
play_1   | net/http.HandlerFunc.ServeHTTP(0x79f6a8, 0x9380e0, 0xc4201cc1c0, 0xc42013aa00)
play_1   |      /usr/local/go/src/net/http/server.go:1918 +0x44
play_1   | net/http.(*ServeMux).ServeHTTP(0x96f8e0, 0x9380e0, 0xc4201cc1c0, 0xc42013aa00)
play_1   |      /usr/local/go/src/net/http/server.go:2254 +0x130
play_1   | net/http.serverHandler.ServeHTTP(0xc4200671e0, 0x9380e0, 0xc4201cc1c0, 0xc42013aa00)
play_1   |      /usr/local/go/src/net/http/server.go:2619 +0xb4
play_1   | net/http.(*conn).serve(0xc420070820, 0x9386a0, 0xc420052440)
play_1   |      /usr/local/go/src/net/http/server.go:1801 +0x71d
play_1   | created by net/http.(*Server).Serve
play_1   |      /usr/local/go/src/net/http/server.go:2720 +0x288
play_1   | 2018/02/22 00:03:36 Reusing session a6046697-e15b-4950-82a4-8800afb6e237
play_1   | 2018/02/22 00:03:51 currentForm = {map[run:0x6cb9e0 clean:0x6cbe90 share:0x6cc070]} msgs = [run]
play_1   | 2018/02/22 00:08:12 Collecting 63441298-4047-4a52-b5b8-5a9d45b23a98
play_1   | 2018/02/22 00:08:28 Collecting 764d5a8f-0c6c-4a16-9d0d-4f95aed88fc1
play_1   | 2018/02/22 00:08:52 Collecting a6046697-e15b-4950-82a4-8800afb6e237
play_1   | 2018/02/22 00:25:07 currentForm = {map[run:0x6cb9e0 clean:0x6cbe90 share:0x6cc070]} msgs = [run]
play_1   | panic: strconv.ParseFloat: parsing "3]": invalid syntax
play_1   |
play_1   | goroutine 869 [running]:
play_1   | github.com/rumlang/playground/vendor/github.com/rumlang/rum/parser.(*lexer).stateIdentifier(0xc4200fd560, 0xc4201b88d0)
play_1   |      /go/src/github.com/rumlang/playground/vendor/github.com/rumlang/rum/parser/lexer.go:149 +0xa0c
play_1   | github.com/rumlang/playground/vendor/github.com/rumlang/rum/parser.(*lexer).(github.com/rumlang/playground/vendor/github.com/rumlang/rum/parser.stateIdentifier)-fm(0xc4201b88d0)
play_1   |      /go/src/github.com/rumlang/playground/vendor/github.com/rumlang/rum/parser/lexer.go:168 +0x2a
play_1   | github.com/rumlang/playground/vendor/github.com/rumlang/rum/parser.(*lexer).run(0xc4200fd560)
play_1   |      /go/src/github.com/rumlang/playground/vendor/github.com/rumlang/rum/parser/lexer.go:242 +0x3a
play_1   | created by github.com/rumlang/playground/vendor/github.com/rumlang/rum/parser.newLexer
play_1   |      /go/src/github.com/rumlang/playground/vendor/github.com/rumlang/rum/parser/lexer.go:276 +0x295
keydrevolta commented 6 years ago

dont have time now but this might help a little: https://github.com/rumlang/rum/blob/master/parser/lexer.go#L147

I'd break this big if into another func so the identifier stays only with higher level logic