made source_Code_Locations more reliable (sill oncorrect sometimes)
This commit is contained in:
+13
-9
@@ -4,15 +4,15 @@ namespace Parser {
|
||||
int parser_line;
|
||||
int parser_col;
|
||||
// NOTE(Felix): In this environment, the build in functions will
|
||||
// be loaded, and the macros will be stroed in form of
|
||||
// be loaded, and the macros will be stored in form of
|
||||
// special-lambdas, that get executed in this environment at
|
||||
// read-time. This should always be the global environment.
|
||||
Environment* environment_for_macros;
|
||||
|
||||
proc init(Environment* env) -> void {
|
||||
// NOTE(Felix): it is important to keep the parser environment
|
||||
// up to date with the global environment. When donig tests,
|
||||
// or running a programm we have to reaload it.
|
||||
// up to date with the global environment. When doing tests,
|
||||
// or running a programm we have to reload it.
|
||||
|
||||
// NOTE(Felix): For now we just allow executing built-ins at
|
||||
// read-time (while creating macros). If later we want to
|
||||
@@ -241,18 +241,21 @@ namespace Parser {
|
||||
}
|
||||
}
|
||||
|
||||
Lisp_Object* ret = nullptr;
|
||||
if (quoteType == '\'')
|
||||
return Memory::create_lisp_object_pair(
|
||||
ret = Memory::create_lisp_object_pair(
|
||||
Memory::get_or_create_lisp_object_symbol("quote"),
|
||||
Memory::create_lisp_object_pair(result, Memory::nil));
|
||||
else if (quoteType == '`')
|
||||
return Memory::create_lisp_object_pair(
|
||||
ret = Memory::create_lisp_object_pair(
|
||||
Memory::get_or_create_lisp_object_symbol("quasiquote"),
|
||||
Memory::create_lisp_object_pair(result, Memory::nil));
|
||||
// it has to be an unquote
|
||||
return Memory::create_lisp_object_pair(
|
||||
Memory::get_or_create_lisp_object_symbol("unquote"),
|
||||
Memory::create_lisp_object_pair(result, Memory::nil));
|
||||
else if (quoteType == ',')
|
||||
ret = Memory::create_lisp_object_pair(
|
||||
Memory::get_or_create_lisp_object_symbol("unquote"),
|
||||
Memory::create_lisp_object_pair(result, Memory::nil));
|
||||
inject_scl(ret);
|
||||
return ret;
|
||||
}
|
||||
|
||||
|
||||
@@ -277,6 +280,7 @@ namespace Parser {
|
||||
Lisp_Object* expression = head;
|
||||
|
||||
while (true) {
|
||||
inject_scl(head);
|
||||
if (text[*index_in_text] == '(' ||
|
||||
text[*index_in_text] == '\''||
|
||||
text[*index_in_text] == '`' ||
|
||||
|
||||
Reference in New Issue
Block a user