Closed donproctor closed 11 months ago
I'm glad you're enjoying it, I did too for a long time :)
I can see what you mean, but only if I skip line numbers. For example this works:
10 REM This is a line
20 PRINT "OK"
But this fails:
REM This is a line
PRINT "OK"
That does suggest something is wrong - I guess in the first case the line-number gets silently swallowed. I'll take a look at your fix and try to verify with a decent test-case.
That was pretty quick Steve. And you can't have had this code top-of-mind.
My situation was a bit different than your test, but it's good that you found that too. I was getting the wrong line number printed when I hit an ESCAPE (which I've added) and dropped into an interactive console.
cheers,
Don
On Fri, Dec 15, 2023 at 9:51 PM Steve Kemp @.***> wrote:
I'm glad you're enjoying it, I did too for a long time :)
I can see what you mean, but only if I skip line numbers. For example this works:
10 REM This is a line 20 PRINT "OK"
But this fails:
REM This is a line PRINT "OK"
That does suggest something is wrong - I guess in the first case the line-number gets silently swallowed. I'll take a look at your fix and try to verify with a decent test-case.
— Reply to this email directly, view it on GitHub https://github.com/skx/gobasic/issues/122#issuecomment-1858691335, or unsubscribe https://github.com/notifications/unsubscribe-auth/AGDH5LMZAQRDWWFWGLDKKXTYJUEELAVCNFSM6AAAAABAXGSTLSVHI2DSMVQWIX3LMV43OSLTON2WKQ3PNVWWK3TUHMYTQNJYGY4TCMZTGU . You are receiving this because you authored the thread.Message ID: @.***>
Hello Steve. I'm having great fun working with your code to add my own little additions. Thank you.
I think I've found that the interpreter swallowline() results in an extra increment of the eval.offset counter.
<eval.go ~ 2290> for e.offset < len(e.program) && run { tok := e.program[e.offset] if tok.Type == token.NEWLINE || tok.Type == token.EOF { run = false } else { e.offset++ // I've put his inside and else to prevent final increment since that will happen again after return } }
I'm trying to add an ESCAPE instruction, and then a command line, and was finding the lineno was bypassed if the ESCAPE came after a line with a REM (which calles swallowline).
Anyway, cheers, and have a great day Don