commit 20c138cdba0ab1e53b7806da7919ee500e00dcfd
parent 1e977be6a7314d79f9a8328f5d633ebb3f55842e
Author: Pavel Renev <an2qzavok@gmail.com>
Date: Thu, 7 Oct 2021 19:07:04 +0300
consume and discard a rune after reading a word
Diffstat:
1 file changed, 3 insertions(+), 2 deletions(-)
diff --git a/fortum.go b/fortum.go
@@ -158,10 +158,10 @@ func (F *First) Compile(vals ...int) {
func (F *First) define() error {
var s string
nwp := F.mem.data[dep]
- _, err := fmt.Fscan(F.in, &s)
- if err != nil {
+ if _, err := fmt.Fscan(F.in, &s); err != nil {
return err
}
+ F.in.ReadRune()
F.strings = append(F.strings, s)
id := len(F.strings) - 1
F.Compile(F.lwp, id, -2)
@@ -178,6 +178,7 @@ func (F *First) _read() error {
if _, err = fmt.Fscan(F.in, &s); err != nil {
return err
}
+ F.in.ReadRune()
switch s {
case "S":
fmt.Println(F.stack.data)