Exemplo n.º 1
0
static void statement(void)
{
  char* name;
  integer val;
  char* str;
  {
    if (scan_test(NULL, SCAN_P_ID, NULL))
    {
      scan_test(NULL, SCAN_P_ID, &statement_stop);
      name = SCAN_CAST->id;
      scan_();
       if (symbol_lookup_key(mini, &name, NULL) == NULL)\
                 {\
                   text_message(TEXT_ERROR, "Undeclared variable '%s'\n", name);\
                   symbol_insert_key(mini, &name, sizeof(char*), sizeof(mini_data));\
                 }\
              
      scan_test(NULL, RDP_T_61 /* = */, &statement_stop);
      scan_();
      val = e1();
       mini_cast(symbol_lookup_key(mini, &name, NULL))->i = val; 
    }
    else
    if (scan_test(NULL, RDP_T_print, NULL))
    {
      scan_test(NULL, RDP_T_print, &statement_stop);
      scan_();
      scan_test(NULL, RDP_T_40 /* ( */, &statement_stop);
      scan_();
      { /* Start of rdp_statement_3 */
        while (1)
        {
          scan_test_set(NULL, &rdp_statement_3_first, &statement_stop);
          {
            if (scan_test_set(NULL, &rdp_statement_1_first, NULL))
            {
              val = e1();
               printf("%li", val); 
            }
            else
            if (scan_test(NULL, RDP_T_34 /* " */, NULL))
            {
              str = String();
               printf("%s", str); 
            }
            else
              scan_test_set(NULL, &rdp_statement_3_first, &statement_stop)            ;
            }
          if (SCAN_CAST->token != RDP_T_44 /* , */) break;
          scan_();
        }
      } /* end of rdp_statement_3 */
      scan_test(NULL, RDP_T_41 /* ) */, &statement_stop);
      scan_();
    }
    else
      scan_test_set(NULL, &statement_first, &statement_stop)    ;
    scan_test_set(NULL, &statement_stop, &statement_stop);
   }
}
Exemplo n.º 2
0
int scan_token_number(char *keyword)
{
  scan_data *this_scanner_symbol;

  if ((this_scanner_symbol = (scan_data*) symbol_lookup_key(scan_table, &keyword, NULL)) == NULL)
    return SCAN_P_IGNORE;
  else
    return this_scanner_symbol->token;
}
Exemplo n.º 3
0
static integer e5(void)
{
  integer result;
  char* name;
  {
    if (scan_test(NULL, SCAN_P_ID, NULL))
    {
      scan_test(NULL, SCAN_P_ID, &e5_stop);
      name = SCAN_CAST->id;
      scan_();
       if (symbol_lookup_key(mini, &name, NULL) == NULL)\
                 {\
                   text_message(TEXT_ERROR, "Undeclared variable '%s'\n", name);\
                   symbol_insert_key(mini, &name, sizeof(char*), sizeof(mini_data));\
                 }\
              
 result = mini_cast(symbol_lookup_key(mini, &name, NULL))->i; 
    }
    else
    if (scan_test(NULL, SCAN_P_INTEGER, NULL))
    {
      scan_test(NULL, SCAN_P_INTEGER, &e5_stop);
      result = SCAN_CAST->data.i;
      scan_();
    }
    else
    if (scan_test(NULL, RDP_T_40 /* ( */, NULL))
    {
      scan_test(NULL, RDP_T_40 /* ( */, &e5_stop);
      scan_();
      result = e1();
      scan_test(NULL, RDP_T_41 /* ) */, &e5_stop);
      scan_();
    }
    else
      scan_test_set(NULL, &e5_first, &e5_stop)    ;
    scan_test_set(NULL, &e5_stop, &e5_stop);
   }
  return result;
}
Exemplo n.º 4
0
static int rdp_check_identifier(char * id)
{
  rdp_data * s =(rdp_data *) symbol_lookup_key(rdp, & id, NULL); 
  
  if (s != NULL)
  {
    if (s->kind == K_PRIMARY)
    {
      text_message(TEXT_ERROR, "identifier \'%s\' is a C++ reserved word or library identifier\n", id); 
      return 1; 
    }
  }
  return 0; 
}