diff options
author | Julien Dessaux | 2021-12-04 00:07:41 +0100 |
---|---|---|
committer | Julien Dessaux | 2021-12-04 00:07:41 +0100 |
commit | 2dbd22114b4906c6ae60de15f4c30a5ea38441c6 (patch) | |
tree | b8035d711eee7e69b33a0bc59f8cf034a1c53f74 /pkg/pointer/exec.go | |
parent | Renamed headless_interpreter to gofunge98 (diff) | |
download | gofunge98-2dbd22114b4906c6ae60de15f4c30a5ea38441c6.tar.gz gofunge98-2dbd22114b4906c6ae60de15f4c30a5ea38441c6.tar.bz2 gofunge98-2dbd22114b4906c6ae60de15f4c30a5ea38441c6.zip |
Fixed standard input error handling
Diffstat (limited to '')
-rw-r--r-- | pkg/pointer/exec.go | 12 |
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() |