Make nil and t parse to symbols and make the top level env look them up
This commit is contained in:
@@ -136,6 +136,13 @@ Ast_Node* lookup_symbol(Symbol* sym, Environment* env) {
|
|||||||
return result;
|
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);
|
result = create_ast_node_built_in_function(sym->identifier);
|
||||||
if (result)
|
if (result)
|
||||||
return result;
|
return result;
|
||||||
|
|||||||
@@ -101,13 +101,6 @@ Ast_Node* parse_keyword(char* text, int* index_in_text) {
|
|||||||
Ast_Node* parse_symbol(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
|
// we are now at the first char of the symbol
|
||||||
char* str_symbol = read_atom(text, index_in_text);
|
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);
|
return create_ast_node_symbol(str_symbol);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user