feat(symbols): --compact bayrağı + referenceCount alanı

- 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
This commit is contained in:
saqut 2026-06-18 16:44:03 +03:00
parent 1af9ea8a2b
commit 895c4c807d
4 changed files with 20 additions and 8 deletions

Binary file not shown.

View File

@ -29,3 +29,9 @@
8929 12696 1781788895536938159 CMakeFiles/saqut.dir/src/tokenizer/tokenizer.cpp.o a01677f8bb4f4dbc 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 6106 13677 1781788892713934912 CMakeFiles/saqut.dir/src/symbol/symbol_collector.cpp.o 3348f498f369213d
13677 13929 1781788900284943608 saqut 8525928b86934b0a 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

View File

@ -32,6 +32,7 @@ struct CliArgs {
std::string format; std::string format;
bool showHelp = false; bool showHelp = false;
bool stdinMode = 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]; if (i + 1 < argc) args.format = argv[++i];
continue; continue;
} }
if (arg == "--compact") {
args.compact = true;
continue;
}
if (arg.compare(0, 5, "file:") == 0) { if (arg.compare(0, 5, "file:") == 0) {
args.positional.push_back(arg.substr(5)); args.positional.push_back(arg.substr(5));
continue; continue;

View File

@ -52,6 +52,7 @@ inline int cmdSymbols(const CliArgs& args) {
{"type", s->type.toString()}, {"type", s->type.toString()},
{"typeDetail", s->type.toJsonObj()}, {"typeDetail", s->type.toJsonObj()},
{"definition", s->definitionLoc.toJsonObj()}, {"definition", s->definitionLoc.toJsonObj()},
{"referenceCount", static_cast<int>(s->references.size())},
{"references", refs}, {"references", refs},
{"isBuiltin", s->isBuiltin} {"isBuiltin", s->isBuiltin}
}); });
@ -59,7 +60,7 @@ inline int cmdSymbols(const CliArgs& args) {
out["symbols"] = symArray; out["symbols"] = symArray;
out["diagnostics"] = diag.toJsonObj(); out["diagnostics"] = diag.toJsonObj();
std::cout << out.dump(2) << "\n"; std::cout << (args.compact ? out.dump() : out.dump(2)) << "\n";
delete ast; delete ast;
for (auto* t : tokens) delete t; for (auto* t : tokens) delete t;