Enable uBasic to run from the command line

Replace use-basic with run-basic
This commit is contained in:
Jeremy Green 2025-09-02 20:09:51 +01:00
parent cc07193c23
commit 1607012cdd
6 changed files with 113 additions and 19 deletions

View file

@ -43,6 +43,8 @@
static char const *ptr, *nextptr;
static char const *prog;
#define MAX_NUMLEN 6
struct keyword_token {
@ -119,6 +121,9 @@ get_next_token(void)
int i;
DEBUG_PRINTF("get_next_token(): '%s'\n", ptr);
// eat all whitespace
while(*ptr == ' ' || *ptr == '\t' || *ptr == '\r') ptr++;
if(*ptr == 0) {
return TOKENIZER_ENDOFINPUT;
@ -170,8 +175,7 @@ get_next_token(void)
return TOKENIZER_ERROR;
}
/*---------------------------------------------------------------------------*/
void
tokenizer_goto(const char *program)
void tokenizer_goto(const char *program)
{
ptr = program;
current_token = get_next_token();
@ -180,7 +184,8 @@ tokenizer_goto(const char *program)
void
tokenizer_init(const char *program)
{
tokenizer_goto(program);
ptr = program;
prog = program;
current_token = get_next_token();
}
/*---------------------------------------------------------------------------*/