Closed jgharston closed 3 years ago
Internally, Brandy uses separate tokens for TIME and TIME$ (thus, you have the odd effect of entering a program with TI.$ will appear to expand correctly but will crash with Syntax Error. Save and load it again, it will work, as it'll be saved as plaintext and be re-tokenised upon loading!). Are you entering Brandy's internal tokens or loading an Acorn/Z80 tokenised file?
As or the crunched version, looking at the memory with LISTB PAGE it looks like the tokeniser (tokens.c function tokenise_source or the routines it calls, possibly kwsearch() ) is failing to recognise TIME$ as a token when there is no whitespace after it.
This definitely warrants further investigation.
A bit o a kludge, but forcing a token string to stop being built after it reaches a (, or after a $ if not followed by a (
I'll work more on this with a view to removing the separate token for TIME$ and fold the functionality into TIME
TIME$ token is no more, it now uses TIME + $ as per Acorn. It also means the abbreviated form TI.$ also works. And the kludge added to fix this issue is no longer required as your example still works with the kludge removed.
Closing this ticket as fixed.
10 A%=TRUE 20 IFA%:A$=TIME$ELSEA$=""
Gives 'Cannot find variable TIME$'.
Uncrunched: 20 IF A%:A$=TIME$ ELSE A$="" works fine.
This happens whether it is entered in Brandy or as prewritten code with the tokenised line: [tokenIF]A%:A$=[tokenTIME]$[tokenELSE]A$=""
Not sure where it's occuring. In "normal" BASIC the fnTIME routine called by evaluating tknTIME does: if byte[next]<>'$' branch to TIME next++ do TIME$
Version 1.22.9 (MinGW/x86/SDL) 06 Jan 2021