MCPcopy Create free account
hub / github.com/FastLED/FastLED / parse2

Method parse2

src/fl/stl/json.cpp.hpp:1084–1100  ·  view source on GitHub ↗

PARSE2 IMPLEMENTATION - Milestone 8: Two-phase parser with validation

Source from the content-addressed store, hash-verified

1082
1083// PARSE2 IMPLEMENTATION - Milestone 8: Two-phase parser with validation
1084fl::shared_ptr<json_value> json_value::parse2(const fl::string& txt) {
1085 JsonTokenizer tokenizer;
1086
1087 // Phase 1: Validate
1088 JsonValidator validator;
1089 if (!tokenizer.parse(txt, validator) || !validator.is_valid()) {
1090 return fl::make_shared<json_value>(nullptr);
1091 }
1092
1093 // Phase 2: Build
1094 JsonBuilder builder;
1095 if (!tokenizer.parse(txt, builder)) {
1096 return fl::make_shared<json_value>(nullptr);
1097 }
1098
1099 return builder.get_result();
1100}
1101
1102// Phase 1 validation only (for testing - MUST allocate zero heap memory)
1103bool json_value::parse2_validate_only(const fl::string& txt) {

Callers

nothing calls this directly

Calls 3

get_resultMethod · 0.80
parseMethod · 0.45
is_validMethod · 0.45

Tested by

no test coverage detected