Example #1
0
/*---------------------------------------------------------------------------*/
static uint8_t statement(void)
{
  int token;

  string_temp_free();

  token = current_token;
  /* LET may be omitted.. */
  if (token != TOKENIZER_INTVAR && token != TOKENIZER_STRINGVAR)
    accept_tok(token);

  switch(token) {
  case TOKENIZER_QUESTION:
  case TOKENIZER_PRINT:
    print_statement();
    break;
  case TOKENIZER_IF:
    if_statement();
    break;
  case TOKENIZER_GO:
    go_statement();
    return 0;
  case TOKENIZER_RETURN:
    return_statement();
    break;
  case TOKENIZER_FOR:
    for_statement();
    break;
  case TOKENIZER_POKE:
    poke_statement();
    break;
  case TOKENIZER_NEXT:
    next_statement();
    break;
  case TOKENIZER_STOP:
    stop_statement();
    break;
  case TOKENIZER_REM:
    rem_statement();
    break;
  case TOKENIZER_DATA:
    data_statement();
    break;
  case TOKENIZER_RANDOMIZE:
    randomize_statement();
    break;
  case TOKENIZER_OPTION:
    option_statement();
    break;
  case TOKENIZER_INPUT:
    input_statement();
    break;
  case TOKENIZER_RESTORE:
    restore_statement();
    break;
  case TOKENIZER_DIM:
    dim_statement();
    break;
  case TOKENIZER_CLS:
    cls_statement();
    break;
  case TOKENIZER_LET:
  case TOKENIZER_STRINGVAR:
  case TOKENIZER_INTVAR:
    let_statement();
    break;
  default:
    DEBUG_PRINTF("ubasic.c: statement(): not implemented %d\n", token);
    syntax_error();
  }
  return 1;
}
Example #2
0
//static void statement(void)
void statement(void)
{
	int token;
	token = tokenizer_token();

	switch(token) {
		case TOKENIZER_PRINT:
			print_statement();
			break;
		case TOKENIZER_IF:
			if_statement();
			break;
		case TOKENIZER_GOTO:
			goto_statement();
			break;
		case TOKENIZER_GOSUB:
			gosub_statement();
			break;
		case TOKENIZER_RETURN:
			return_statement();
			break;
		case TOKENIZER_FOR:
			for_statement();
			break;
		case TOKENIZER_NEXT:
			next_statement();
			break;
		case TOKENIZER_END:
			end_statement();
			break;
		case TOKENIZER_PSET:
			pset_statement();
			break;
		case TOKENIZER_CLS:
			cls_statement();
			break;
		case TOKENIZER_REFRESH:
			refresh_statement();
			break;
		case TOKENIZER_LIST:
			list_statement();
			break;
		case TOKENIZER_LOAD:
			load_statement();
			break;
		case TOKENIZER_SAVE:
			save_statement();
			break;
		case TOKENIZER_FILES:
			files_statement();
			break;
		case TOKENIZER_PEEK:
			peek_statement();
			break;
		case TOKENIZER_POKE:
			poke_statement();
			break;
		case TOKENIZER_WAIT:
			wait_statement();
			break;
		case TOKENIZER_INPUT:
			input_statement();
			break;
		case TOKENIZER_INP:
			inp_statement();
			break;
		case TOKENIZER_INR:
			inr_statement();
			break;
		case TOKENIZER_INA:
			ina_statement();
			break;
		case TOKENIZER_REM:
			rem_statement();
			break;
		case TOKENIZER_RUN:
			run_statement();
			break;
		case TOKENIZER_ERROR:
			tokenizer_error_print();
			ended = 1;
			glcd_DrawCursor();
			break;
		case TOKENIZER_LET:
			accept(TOKENIZER_LET);
			accept(TOKENIZER_VARIABLE);
			accept(TOKENIZER_CR);
			break;
			/* Fall through. */
		case TOKENIZER_VARIABLE:
			let_statement();
			break;
		default:
			exit(1);
	}
}