mirror of
https://github.com/adamdunkels/ubasic.git
synced 2026-11-22 04:29:43 +00:00
Enable uBasic to run from the command line
Replace use-basic with run-basic
This commit is contained in:
parent
cc07193c23
commit
1607012cdd
6 changed files with 113 additions and 19 deletions
11
tokenizer.c
11
tokenizer.c
|
|
@ -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();
|
||||
}
|
||||
/*---------------------------------------------------------------------------*/
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue