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

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
This commit is contained in:
saqut 2026-06-18 16:44:03 +03:00
parent 98b4bc6114
commit c69a9b363d
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
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

View File

@ -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;

View File

@ -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<int>(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;