From c69a9b363d6a8d3fcd656bf27f170354c3888eb6 Mon Sep 17 00:00:00 2001 From: saqut Date: Thu, 18 Jun 2026 16:44:03 +0300 Subject: [PATCH] =?UTF-8?q?feat(symbols):=20--compact=20bayra=C4=9F=C4=B1?= =?UTF-8?q?=20+=20referenceCount=20alan=C4=B1?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit - CliArgs'e compact bool eklendi; --compact ile boşluksuz JSON çıktısı - symbols çıktısında her sembol için referenceCount (references.size()) alanı eklendi - fibonacci.sqt onarıldı: araç hatası sonucu silinen '{' geri konuldu Co-Authored-By: Claude Opus 4.8 --- build/.ninja_deps | Bin 59228 -> 64224 bytes build/.ninja_log | 6 ++++++ src/cli/args.hpp | 5 +++++ src/cli/commands/symbols.hpp | 17 +++++++++-------- 4 files changed, 20 insertions(+), 8 deletions(-) diff --git a/build/.ninja_deps b/build/.ninja_deps index e3f62fafc2edd8aab497471d1385eaffd4eda93f..b8c5440f248b10951ffad5672392389d5921af93 100644 GIT binary patch delta 126 zcmca}j`_h?<_$5=`FPkE8k!gx7#=<}s#P-BTz8d;jjw}&pn+a diff --git a/build/.ninja_log b/build/.ninja_log index ea7a311..fef9a49 100644 --- a/build/.ninja_log +++ b/build/.ninja_log @@ -29,3 +29,9 @@ 8929 12696 1781788895536938159 CMakeFiles/saqut.dir/src/tokenizer/tokenizer.cpp.o a01677f8bb4f4dbc 6106 13677 1781788892713934912 CMakeFiles/saqut.dir/src/symbol/symbol_collector.cpp.o 3348f498f369213d 13677 13929 1781788900284943608 saqut 8525928b86934b0a +1 4141 1781789523129566061 CMakeFiles/saqut.dir/src/main.cpp.o 110c26cb1d0c3a23 +4141 4368 1781789527269569791 saqut 8525928b86934b0a +1 4518 1781789532082574122 CMakeFiles/saqut.dir/src/main.cpp.o 110c26cb1d0c3a23 +4518 4748 1781789536593578177 saqut 8525928b86934b0a +1 2516 1781789879291876730 CMakeFiles/saqut.dir/src/parser/parser.cpp.o 2c65b7be26cead32 +2516 2743 1781789881806878867 saqut 8525928b86934b0a diff --git a/src/cli/args.hpp b/src/cli/args.hpp index 6dddc7c..31317b0 100644 --- a/src/cli/args.hpp +++ b/src/cli/args.hpp @@ -32,6 +32,7 @@ struct CliArgs { std::string format; bool showHelp = false; bool stdinMode = false; + bool compact = false; // --compact: boşluksuz JSON }; // ============================================================================ @@ -67,6 +68,10 @@ inline CliArgs parseArgs(int argc, char* argv[]) { if (i + 1 < argc) args.format = argv[++i]; continue; } + if (arg == "--compact") { + args.compact = true; + continue; + } if (arg.compare(0, 5, "file:") == 0) { args.positional.push_back(arg.substr(5)); continue; diff --git a/src/cli/commands/symbols.hpp b/src/cli/commands/symbols.hpp index b875ce9..0df8401 100644 --- a/src/cli/commands/symbols.hpp +++ b/src/cli/commands/symbols.hpp @@ -47,19 +47,20 @@ inline int cmdSymbols(const CliArgs& args) { refs.push_back(r.toJsonObj()); symArray.push_back({ - {"name", s->name}, - {"kind", symbolKindName(s->kind)}, - {"type", s->type.toString()}, - {"typeDetail", s->type.toJsonObj()}, - {"definition", s->definitionLoc.toJsonObj()}, - {"references", refs}, - {"isBuiltin", s->isBuiltin} + {"name", s->name}, + {"kind", symbolKindName(s->kind)}, + {"type", s->type.toString()}, + {"typeDetail", s->type.toJsonObj()}, + {"definition", s->definitionLoc.toJsonObj()}, + {"referenceCount", static_cast(s->references.size())}, + {"references", refs}, + {"isBuiltin", s->isBuiltin} }); } out["symbols"] = symArray; out["diagnostics"] = diag.toJsonObj(); - std::cout << out.dump(2) << "\n"; + std::cout << (args.compact ? out.dump() : out.dump(2)) << "\n"; delete ast; for (auto* t : tokens) delete t;