example/ivy/android: fix demo to handle comments & 'quit' correctly

Demo feature is implemented by reading the demo.ivy file included
as an asset, read lines, and feed each line to mobile.Eval if it
is not a comment line. Comments can start from the middle of a line
so previously, the code simply looked for '#' in each line and
treated the substring starting from it as a comment. This assumption
is not correct - see ")format '%#x'". Without proper parsing, it is
hard to do it correctly. This CL passes the entire line to Ivy as
it is - the backend correctly parses the line with comments.
One drawback of this change is, unlike the line comments, we don't
apply the style for comments (gray font). But correctness is more
important. This also simplifies the code.

This CL implements the 'quit' command that terminates a demo
session (as mentioned in the demo.ivy script).

Change-Id: Ib0801338e0dd34c52c6c6209fe47a1846e71f0c8
Reviewed-on: https://go-review.googlesource.com/c/mobile/+/356732
Run-TryBot: Hyang-Ah Hana Kim <hyangah@gmail.com>
TryBot-Result: Go Bot <gobot@golang.org>
Trust: Hyang-Ah Hana Kim <hyangah@gmail.com>
Reviewed-by: Hajime Hoshi <hajimehoshi@gmail.com>
1 file changed
tree: 1f1833dd3a2a85936b211f8e591e4d344b3f1865
  1. app/
  2. asset/
  3. bind/
  4. cmd/
  5. doc/
  6. event/
  7. example/
  8. exp/
  9. geom/
  10. gl/
  11. internal/
  12. testdata/
  13. .gitattributes
  14. .gitignore
  16. codereview.cfg
  19. go.mod
  20. go.sum
  23. README.md

Go support for Mobile devices

Go Reference

The Go mobile repository holds packages and build tools for using Go on mobile platforms.

Package documentation as a starting point:

Caution image

The Go Mobile project is experimental. Use this at your own risk. While we are working hard to improve it, neither Google nor the Go team can provide end-user support.

This is early work and installing the build system requires Go 1.5. Follow the instructions on golang.org/wiki/Mobile to install the gomobile command, build the basic and the bind example apps.

Contributions to Go are appreciated. See https://golang.org/doc/contribute.html.