Просмотр исходного кода

Make nil and t parse to symbols and make the top level env look them up

master
FelixBrendel 7 лет назад
Родитель
Сommit
ad7dd86667
2 измененных файлов: 7 добавлений и 7 удалений
  1. +7
    -0
      src/env.c
  2. +0
    -7
      src/parse.c

+ 7
- 0
src/env.c Просмотреть файл

@@ -136,6 +136,13 @@ Ast_Node* lookup_symbol(Symbol* sym, Environment* env) {
return result;
}

if (string_equal(sym->identifier, "nil")) {
return create_ast_node_nil();
}
if (string_equal(sym->identifier, "t")) {
return create_ast_node_t();
}

result = create_ast_node_built_in_function(sym->identifier);
if (result)
return result;


+ 0
- 7
src/parse.c Просмотреть файл

@@ -101,13 +101,6 @@ Ast_Node* parse_keyword(char* text, int* index_in_text) {
Ast_Node* parse_symbol(char* text, int* index_in_text) {
// we are now at the first char of the symbol
char* str_symbol = read_atom(text, index_in_text);

if (string_equal(str_symbol, "nil")) {
return create_ast_node_nil();
}
if (string_equal(str_symbol, "t")) {
return create_ast_node_t();
}
return create_ast_node_symbol(str_symbol);
}



Загрузка…
Отмена
Сохранить