Exemple #1
0
/**
 * CTRParserReceiver
 *
 * Generates a node to represent a receiver (of a message).
 */
ctr_tnode* ctr_cparse_receiver() {
	int t;
	if (ctr_mode_debug) printf("Parsing receiver.\n");
	t = ctr_clex_tok();
	ctr_clex_putback();
	switch(t){
		case CTR_TOKEN_NIL:
			return ctr_cparse_nil();
		case CTR_TOKEN_BOOLEANYES:
			return ctr_cparse_true();
		case CTR_TOKEN_BOOLEANNO:
			return ctr_cparse_false();
		case CTR_TOKEN_NUMBER:
			return ctr_cparse_number();
		case CTR_TOKEN_QUOTE:
			return ctr_cparse_string();
		case CTR_TOKEN_REF:
			return ctr_cparse_ref();
		case CTR_TOKEN_BLOCKOPEN:
			return ctr_cparse_block();
		case CTR_TOKEN_PAROPEN:
			return ctr_cparse_popen();
		default:
			printf("Error, unexpected token: %d.\n", t);
			exit(1);
	}
}
Exemple #2
0
/**
 * CTRParserReceiver
 *
 * Generates a node to represent a receiver (of a message).
 */
ctr_tnode* ctr_cparse_receiver() {
	int t;
	if (ctr_mode_debug) printf("Parsing receiver.\n");
	t = ctr_clex_tok();
	ctr_clex_putback();
	if (t == CTR_TOKEN_NIL) return ctr_cparse_nil();
	if (t == CTR_TOKEN_BOOLEANYES) return ctr_cparse_true();
	if (t == CTR_TOKEN_BOOLEANNO) return ctr_cparse_false();
	if (t == CTR_TOKEN_NUMBER) return ctr_cparse_number();
	if (t == CTR_TOKEN_QUOTE) return ctr_cparse_string();
	if (t == CTR_TOKEN_REF) return ctr_cparse_ref();
	if (t == CTR_TOKEN_BLOCKOPEN) return ctr_cparse_block();
	if (t == CTR_TOKEN_PAROPEN) return ctr_cparse_popen();
	printf("Error, unexpected token: %d.\n", t);
	exit(1);
}
Exemple #3
0
/**
 * CTRParserReceiver
 *
 * Generates a node to represent a receiver (of a message).
 */
ctr_tnode *
ctr_cparse_receiver ()
{
  int t;
  t = ctr_clex_tok ();
  ctr_clex_putback ();
  switch (t)
    {
    case CTR_TOKEN_NIL:
      return ctr_cparse_nil ();
    case CTR_TOKEN_BOOLEANYES:
      return ctr_cparse_true ();
    case CTR_TOKEN_BOOLEANNO:
      return ctr_cparse_false ();
    case CTR_TOKEN_NUMBER:
      return ctr_cparse_number ();
    case CTR_TOKEN_QUOTE:
      return ctr_cparse_string ();
    case CTR_TOKEN_REF:
      return ctr_cparse_ref ();
    case CTR_TOKEN_BLOCKOPEN:
      return ctr_cparse_block ();
    case CTR_TOKEN_BLOCKOPEN_MAP:
      {
	ctr_tnode *t = ctr_cparse_block_capture ();
	t->lexical = 1;
	t->nodes->next->node->lexical = 1;
	return t;
      }
    case CTR_TOKEN_PAROPEN:
      return ctr_cparse_popen ();
    case CTR_TOKEN_TUPOPEN:
      return ctr_cparse_tuple ();
    case CTR_TOKEN_SYMBOL:
      return ctr_cparse_symbol ();
    default:
      /* This function always exits, so return a dummy value. */
      ctr_cparse_emit_error_unexpected (t, "Expected a message recipient.\n");
      return NULL;
    }
}