diff --git a/nasal_gc.h b/nasal_gc.h index 552f93a1..3c2977a2 100644 --- a/nasal_gc.h +++ b/nasal_gc.h @@ -157,17 +157,12 @@ nasal_ref* nasal_vec::get_mem(const int index) void nasal_vec::print() { static int depth=0; - if(!elems.size()) + if(!elems.size() || depth>8) { - std::cout<<"[]"; - return; - } - if(++depth>16) - { - std::cout<<"[..]"; - --depth; + std::cout<<(elems.size()?"[..]":"[]"); return; } + ++depth; size_t iter=0; std::cout<<'['; for(auto& i:elems) @@ -219,17 +214,12 @@ nasal_ref* nasal_hash::get_mem(const std::string& key) void nasal_hash::print() { static int depth=0; - if(!elems.size()) - { - std::cout<<"{}"; - return; - } - if(++depth>16) + if(!elems.size() || depth>8) { - std::cout<<"{..}"; - --depth; + std::cout<<(elems.size()?"{..}":"{}"); return; } + ++depth; size_t iter=0; std::cout<<'{'; for(auto& i:elems) diff --git a/test/calc.nas b/test/calc.nas index f4b9b1ae..cb25994f 100644 --- a/test/calc.nas +++ b/test/calc.nas @@ -1,50 +1,96 @@ import("lib.nas"); -var filename=[ - "main.cpp", - "nasal_err.h", - "nasal_ast.h", - "nasal_builtin.h", - "nasal_codegen.h", - "nasal_opt.h", - "nasal_gc.h", - "nasal_import.h", - "nasal_lexer.h", - "nasal_parse.h", - "nasal_vm.h", - "nasal_dbg.h", - "nasal.h" +var source=[ + "main.cpp ", + "nasal_err.h ", + "nasal_ast.h ", + "nasal_builtin.h ", + "nasal_codegen.h ", + "nasal_opt.h ", + "nasal_gc.h ", + "nasal_import.h ", + "nasal_lexer.h ", + "nasal_parse.h ", + "nasal_vm.h ", + "nasal_dbg.h ", + "nasal.h " ]; -var space=[ - " ", - " ", - " ", - "", - "", - " ", - " ", - " ", - " ", - " ", - " ", - " ", - " " + +var lib=[ + "stl/lib.nas ", + "stl/list.nas ", + "stl/queue.nas ", + "stl/result.nas ", + "stl/sort.nas ", + "stl/stack.nas " ]; + +var testfile=[ + "test/ascii-art.nas ", + "test/auto_crash.nas ", + "test/bf.nas ", + "test/bfconvertor.nas ", + "test/bfs.nas ", + "test/bigloop.nas ", + "test/bp.nas ", + "test/calc.nas ", + "test/choice.nas ", + "test/class.nas ", + "test/exception.nas ", + "test/fib.nas ", + "test/filesystem.nas ", + "test/hexdump.nas ", + "test/json.nas ", + "test/leetcode1319.nas ", + "test/lexer.nas ", + "test/life.nas ", + "test/loop.nas ", + "test/mandel.nas ", + "test/mandelbrot.nas ", + "test/module_test.nas ", + "test/nasal_test.nas ", + "test/pi.nas ", + "test/prime.nas ", + "test/props.nas ", + "test/quick_sort.nas ", + "test/scalar.nas ", + "test/trait.nas ", + "test/turingmachine.nas", + "test/ycombinator.nas " +]; + +var module=[ + "module/fib.cpp " +]; + +var getname=func(s){ + var (len,ch)=(size(s),' '[0]); + for(var i=0;i