diff --git a/src/codeobject.h b/src/codeobject.h index 80ad7bea..aa817eed 100644 --- a/src/codeobject.h +++ b/src/codeobject.h @@ -167,7 +167,6 @@ struct CodeObject { void write(VM* vm, CodeObjectSerializer& ss) const{ ss.write_begin_mark(); // [ - ss.write_str(src->source); // src->source ss.write_str(src->filename); // src->filename ss.write_int(src->mode); // src->mode ss.write_end_mark(); // ] @@ -175,10 +174,7 @@ struct CodeObject { ss.write_bool(is_generator); // is_generator ss.write_begin_mark(); // [ for(Bytecode bc: codes){ - if(StrName::is_valid(bc.arg)){ - // std::cout << bc.arg << StrName(bc.arg).sv() << std::endl; - ss.names.insert(StrName(bc.arg)); - } + if(StrName::is_valid(bc.arg)) ss.names.insert(StrName(bc.arg)); ss.write_bytes(bc); } ss.write_end_mark(); // ] diff --git a/src/error.h b/src/error.h index 15d159b9..b8e7d697 100644 --- a/src/error.h +++ b/src/error.h @@ -43,10 +43,11 @@ struct SourceData { int index = 0; // Skip utf8 BOM if there is any. if (strncmp(source.begin(), "\xEF\xBB\xBF", 3) == 0) index += 3; - // Remove all '\r' + // Replace all '\r' with ' ' std::stringstream ss; while(index < source.length()){ - if(source[index] != '\r') ss << source[index]; + if(source[index] == '\r') ss << ' '; + else ss << source[index]; index++; }