renamed prog to begin and added basics for the manual

This commit is contained in:
Felix Brendel
2019-05-15 01:08:44 +02:00
parent 0fb9fbe1ee
commit 5548192dc9
17 changed files with 475 additions and 54 deletions
+14 -10
View File
@@ -161,21 +161,25 @@ namespace Parser {
// okay so the first letter was not actually closing the string...
int string_length = 0;
while (text[*index_in_text+string_length] != '"' ||
text[*index_in_text+string_length] == '\\')
bool escaping = false;
while (!(text[*index_in_text+string_length] == '"' && !escaping))
{
if (escaping)
escaping = false;
else
if (text[*index_in_text+string_length] == '\\')
escaping = true;
++string_length;
}
// we found the end of the string
text[*index_in_text+string_length] = '\0';
if (!unescape_string(text+(*index_in_text))) {
create_parsing_error(
"The string '%s' at %s:%d:%d could not be unescaped.",
text+(*index_in_text), parser_file, parser_line, parser_col);
return nullptr;
}
// NOTE(Felix): Tactic: Through unescaping the string will
// only get shorter, so we replace it inplace and later jump
// to the original end of the string.
try unescape_string(text+(*index_in_text));
String* string = Memory::create_string("", string_length);
@@ -415,9 +419,9 @@ namespace Parser {
}
// we are now in the function body, just wrap it in an
// implicit prog
// implicit begin
try macro->value.function.body = Memory::create_lisp_object_pair(
Memory::get_or_create_lisp_object_symbol("prog"),
Memory::get_or_create_lisp_object_symbol("begin"),
body);
// macro->value.function = function;