Repository navigation
json parser: collapse the parser indirection into a single JsonParser implementation - #677
Conversation
|
Documentation preview for this pull request is available at: |
cb2ab16 to
0ee14aa
Compare
There was a problem hiding this comment.
🟡 Changes recommended
Migrated tests retain obsolete requirement metadata, and the moved class members violate the documented member-comment convention.
4 open findings
What changed in this PR
Consolidates vaJson parsing into JsonParser, removing the redundant parser layer while preserving the public API.
Changes:
- Moves tree-building and parsing into
json_parser.cpp. - Removes
VajsonParser, its target, and parser alias. - Updates tests, dependencies, coverage scope, and architecture documentation.
| File | Description |
|---|---|
tools/coverage/BUILD |
Removes the obsolete coverage root. |
score/json/json_parser.cpp |
Adds the internal tree builder and parser implementation. |
score/json/internal/parser/vajson/vajson_parser.h |
Removes the redundant parser class. |
score/json/internal/parser/vajson/vajson_parser.cpp |
Removes the former implementation layer. |
score/json/internal/parser/vajson/vajson_parser_test.cpp |
Migrates parser tests to JsonParser. |
score/json/internal/parser/vajson/unit_test/BUILD |
Updates implementation-test dependencies. |
score/json/internal/parser/vajson/number_parser_test.cpp |
Migrates typed parsing tests. |
score/json/internal/parser/vajson/BUILD |
Removes the parser library and updates tests. |
score/json/internal/parser/BUILD |
Removes the parser alias. |
score/json/detailed_design/class_diagram.puml |
Documents the consolidated design. |
score/json/BUILD |
Links the vaJson implementation directly. |
🧠 Review effort: Balanced
💡 Configure MCP servers for context-aware, tailored reviews. Learn more in the docs.
1808d4e to
e548cb7
Compare
7c5e47b to
025ed6a
Compare
| ) | ||
|
|
||
| cc_test( | ||
| name = "vajson_parser_test", |
There was a problem hiding this comment.
it feels like tests target was left behind while parser was moved
| ":parser_interface", | ||
| "@score_baselibs//score/json/internal/parser", | ||
| "@score_baselibs//score/json/internal/model", | ||
| "@score_baselibs//score/json/internal/parser/vajson/vajson_impl", |
There was a problem hiding this comment.
could this be moved to implementation_deps? generally all internal details should be handled that way.
There was a problem hiding this comment.
Done. The internal model, vajson and result deps of json_parser_impl are now in implementation_deps, so they are no longer exposed to consumers.
|
|
||
| #include "score/json/json_parser.h" | ||
|
|
||
| #include "score/json/internal/parser/vajson/vajson_impl/reader.h" |
There was a problem hiding this comment.
couldn't we flatten the directory structure a bit more?
vajson/vajson_impl seems redundant.
There was a problem hiding this comment.
I have tried. vajson_impl is gone. reader/ and util/ now sit directly under vajson/, and the includes are updated to match\
…der internal JsonParser::FromFile and FromBuffer are now defined in json_parser.cpp next to the class. The vaJson tree builder is a file-local class of json_parser.cpp instead of the public VajsonParser, and the vajson_parser library and the parser alias are removed. The public API and behavior are unchanged.
Address review feedback on eclipse-score#677. The vaJson tree builder moved into `json_parser.cpp`, but its two test targets stayed in `internal/parser/vajson/`. They exercise `JsonParser` and use the shared test suites from `internal/parser/`, so they now live next to them, alongside `json_parser_test`. `internal/parser/vajson/BUILD` held only these two targets and is removed. Test sources and target names are unchanged.
Address review feedback on eclipse-score#677. With the vaJson tree builder gone from `internal/parser/vajson/`, the `vajson_impl` subdirectory only repeated the name of its parent. The vaJson reader sources now sit directly in `internal/parser/vajson/`, and the library target is named after its directory: `//score/json/internal/parser/vajson`. All changes are renames plus rewritten include paths and BUILD labels. No source logic changes.
Address review feedback on eclipse-score#677. `json_parser_impl` has no public headers of its own. `json_parser.h` comes from `:parser_interface`, which stays in `deps`. The model, vaJson reader and result targets are only included from `json_parser.cpp`, so they move to `implementation_deps` and no longer leak into the dependency graph of consumers of `:json`. No source changes.
025ed6a to
9e28d87
Compare
# Conflicts: # tools/coverage/BUILD

Closes #634
JsonParser::FromFileandFromBufferare now defined injson_parser.cpp, next to the class they belong to.VajsonParser) is no longer a public class inscore::json. It is a file-local class (AnyTreeBuilder) injson_parser.cpp.vajson_parserlibrary and its header and source, and the//score/json/internal/parser:parseralias, are removed.json_parser_impllinks the vaJson reader directly.JsonParserinstead of the removed class.Structural change only: the public API (
IJsonParser,JsonParser,operator""_json) and the parsing behavior are unchanged. The parser logic is moved as is, including the coverage and Coverity annotations.Tests: all
//score/json/...tests pass, with the same test counts for the vaJson parser suites (27 and 16).