diff --git a/src/main.cpp b/src/main.cpp index 0955be9..40223ec 100644 --- a/src/main.cpp +++ b/src/main.cpp @@ -166,7 +166,7 @@ void execute(const std::string& file, } // run - auto start = clk::now(); + const auto start = clk::now(); if (cmd&VM_DEBUG) { auto debugger = std::unique_ptr(new nasal::dbg); debugger->run(gen, ld, argv, cmd&VM_PROFILE, cmd&VM_PROF_ALL); @@ -178,7 +178,7 @@ void execute(const std::string& file, } // get running time - auto end = clk::now(); + const auto end = clk::now(); if (cmd&VM_TIME) { std::clog << "process exited after "; std::clog << (end-start).count()*1.0/den << "s.\n\n"; @@ -211,7 +211,7 @@ i32 main(i32 argc, const char* argv[]) { } // execute with arguments - const std::unordered_map cmdlst = { + const std::unordered_map command_list = { {"--raw-ast", VM_RAW_AST}, {"--ast", VM_AST}, {"-a", VM_AST}, @@ -233,12 +233,13 @@ i32 main(i32 argc, const char* argv[]) { {"--ref-file", VM_REF_FILE}, {"--limit", VM_LIMIT|VM_EXEC} }; - u32 cmd = 0; + + u32 commands = 0; std::string filename = ""; std::vector vm_argv; for(i32 i = 1; i diff --git a/src/nasal_gc.cpp b/src/nasal_gc.cpp index e402447..215c08a 100644 --- a/src/nasal_gc.cpp +++ b/src/nasal_gc.cpp @@ -222,7 +222,7 @@ void gc::init( continue; } strs[i] = var::gcobj(new nas_val(vm_type::vm_str)); - strs[i].val.gcobj->unmutable = 1; + strs[i].val.gcobj->immutable = 1; strs[i].str() = constant_strings[i]; } @@ -234,7 +234,7 @@ void gc::init( continue; } env_argv[i] = var::gcobj(new nas_val(vm_type::vm_str)); - env_argv[i].val.gcobj->unmutable = 1; + env_argv[i].val.gcobj->immutable = 1; env_argv[i].str() = argv[i]; } } diff --git a/src/nasal_lexer.h b/src/nasal_lexer.h index 4c57f8e..bd0a778 100644 --- a/src/nasal_lexer.h +++ b/src/nasal_lexer.h @@ -177,7 +177,8 @@ private: token dots(); token calc_opr(); public: - lexer(): line(1), column(0), ptr(0), filename(""), res(""), invalid_char(0) {} + lexer(): line(1), column(0), ptr(0), + filename(""), res(""), invalid_char(0) {} const error& scan(const std::string&); const std::vector& result() const {return toks;} }; diff --git a/src/nasal_type.cpp b/src/nasal_type.cpp index 0587f27..5b3cf20 100644 --- a/src/nasal_type.cpp +++ b/src/nasal_type.cpp @@ -198,7 +198,7 @@ std::ostream& operator<<(std::ostream& out, nas_map& mp) { nas_val::nas_val(vm_type val_type) { mark = gc_status::collected; type = val_type; - unmutable = 0; + immutable = 0; switch(val_type) { case vm_type::vm_str: ptr.str = new std::string; break; case vm_type::vm_vec: ptr.vec = new nas_vec; break; diff --git a/src/nasal_type.h b/src/nasal_type.h index a217996..7cd3f17 100644 --- a/src/nasal_type.h +++ b/src/nasal_type.h @@ -250,7 +250,7 @@ struct nas_map { }; struct nas_val { - enum class gc_status:u8 { + enum class gc_status: u8 { uncollected = 0, collected, found @@ -258,7 +258,7 @@ struct nas_val { gc_status mark; vm_type type; // value type - u8 unmutable; // used to mark if a string is unmutable + u8 immutable; // used to mark if a string is immutable union { std::string* str; nas_vec* vec; diff --git a/src/natives/bits_lib.cpp b/src/natives/bits_lib.cpp index 1ccfe6d..61576c5 100644 --- a/src/natives/bits_lib.cpp +++ b/src/natives/bits_lib.cpp @@ -48,7 +48,7 @@ var builtin_fld(context* ctx, gc* ngc) { auto str = local[1]; auto startbit = local[2]; auto length = local[3]; - if (!str.is_str() || str.val.gcobj->unmutable) { + if (!str.is_str() || str.val.gcobj->immutable) { return nas_err("bits::fld", "\"str\" must be mutable string"); } if (!startbit.is_num() || !length.is_num()) { @@ -78,7 +78,7 @@ var builtin_sfld(context* ctx, gc* ngc) { auto str = local[1]; auto startbit = local[2]; auto length = local[3]; - if (!str.is_str() || str.val.gcobj->unmutable) { + if (!str.is_str() || str.val.gcobj->immutable) { return nas_err("bits::sfld", "\"str\" must be mutable string"); } if (!startbit.is_num() || !length.is_num()) { @@ -112,7 +112,7 @@ var builtin_setfld(context* ctx, gc* ngc) { auto startbit = local[2]; auto length = local[3]; auto value = local[4]; - if (!str.is_str() || str.val.gcobj->unmutable) { + if (!str.is_str() || str.val.gcobj->immutable) { return nas_err("bits::setfld", "\"str\" must be mutable string"); } if (!startbit.is_num() || !length.is_num() || !value.is_num()) { diff --git a/src/natives/io_lib.cpp b/src/natives/io_lib.cpp index 9fb4cfc..7f9b469 100644 --- a/src/natives/io_lib.cpp +++ b/src/natives/io_lib.cpp @@ -84,7 +84,7 @@ var builtin_read(context* ctx, gc* ngc) { if (!file_descriptor.object_check(file_type_name)) { return nas_err("io::read", "not a valid filehandle"); } - if (!buffer.is_str() || buffer.val.gcobj->unmutable) { + if (!buffer.is_str() || buffer.val.gcobj->immutable) { return nas_err("io::read", "\"buf\" must be mutable string"); } if (!length.is_num()) { @@ -102,7 +102,7 @@ var builtin_read(context* ctx, gc* ngc) { static_cast(file_descriptor.ghost().pointer) ); buffer.str() = temp_buffer; - buffer.val.gcobj->unmutable = true; + buffer.val.gcobj->immutable = true; delete []temp_buffer; return var::num(read_size); }