aboutsummaryrefslogtreecommitdiff
path: root/pkg/pointer/exec.go
diff options
context:
space:
mode:
authorJulien Dessaux2021-12-04 00:07:41 +0100
committerJulien Dessaux2021-12-04 00:07:41 +0100
commit2dbd22114b4906c6ae60de15f4c30a5ea38441c6 (patch)
treeb8035d711eee7e69b33a0bc59f8cf034a1c53f74 /pkg/pointer/exec.go
parentRenamed headless_interpreter to gofunge98 (diff)
downloadgofunge98-2dbd22114b4906c6ae60de15f4c30a5ea38441c6.tar.gz
gofunge98-2dbd22114b4906c6ae60de15f4c30a5ea38441c6.tar.bz2
gofunge98-2dbd22114b4906c6ae60de15f4c30a5ea38441c6.zip
Fixed standard input error handling
Diffstat (limited to 'pkg/pointer/exec.go')
-rw-r--r--pkg/pointer/exec.go12
1 files changed, 10 insertions, 2 deletions
diff --git a/pkg/pointer/exec.go b/pkg/pointer/exec.go
index 8bb9dba..55020fa 100644
--- a/pkg/pointer/exec.go
+++ b/pkg/pointer/exec.go
@@ -177,9 +177,17 @@ func (p *Pointer) eval(c int, f *field.Field) (done bool, returnValue *int) {
case ',':
p.CharacterOutput(p.ss.head.Pop())
case '&':
- p.ss.head.Push(p.DecimalInput())
+ if v, err := p.DecimalInput(); err != nil {
+ p.Reverse()
+ } else {
+ p.ss.head.Push(v)
+ }
case '~':
- p.ss.head.Push(p.CharacterInput())
+ if v, err := p.CharacterInput(); err != nil {
+ p.Reverse()
+ } else {
+ p.ss.head.Push(v)
+ }
case 'y':
n := p.ss.head.Pop()
now := time.Now()