Fixed standard input error handling

This commit is contained in:
Julien Dessaux 2021-12-04 00:07:41 +01:00
parent 18b1117749
commit 2dbd22114b
3 changed files with 25 additions and 12 deletions

View file

@ -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()