2020-02-04 01:51:24 +08:00
|
|
|
/* auto-generated on Sun Feb 2 15:10:09 PST 2020. Do not edit! */
|
2018-12-31 10:50:10 +08:00
|
|
|
|
|
|
|
#include <iostream>
|
|
|
|
#include "simdjson.h"
|
|
|
|
#include "simdjson.cpp"
|
|
|
|
int main(int argc, char *argv[]) {
|
2019-12-17 08:09:18 +08:00
|
|
|
if(argc < 2) {
|
|
|
|
std::cerr << "Please specify at least one file name. " << std::endl;
|
2019-08-02 04:23:30 +08:00
|
|
|
}
|
2019-02-23 04:42:44 +08:00
|
|
|
const char * filename = argv[1];
|
2019-07-10 07:48:20 +08:00
|
|
|
simdjson::padded_string p = simdjson::get_corpus(filename);
|
|
|
|
simdjson::ParsedJson pj = simdjson::build_parsed_json(p); // do the parsing
|
2019-08-02 04:23:30 +08:00
|
|
|
if( ! pj.is_valid() ) {
|
2019-11-09 06:39:45 +08:00
|
|
|
std::cout << "build_parsed_json not valid" << std::endl;
|
2018-12-31 10:50:10 +08:00
|
|
|
} else {
|
2019-11-09 06:39:45 +08:00
|
|
|
std::cout << "build_parsed_json valid" << std::endl;
|
2018-12-31 10:50:10 +08:00
|
|
|
}
|
2019-12-17 08:09:18 +08:00
|
|
|
if(argc == 2) {
|
|
|
|
return EXIT_SUCCESS;
|
|
|
|
}
|
2019-11-09 06:39:45 +08:00
|
|
|
|
|
|
|
//JsonStream
|
|
|
|
const char * filename2 = argv[2];
|
|
|
|
simdjson::padded_string p2 = simdjson::get_corpus(filename2);
|
|
|
|
simdjson::ParsedJson pj2;
|
2020-01-30 08:00:18 +08:00
|
|
|
simdjson::JsonStream js{p2};
|
2019-11-09 06:39:45 +08:00
|
|
|
int parse_res = simdjson::SUCCESS_AND_HAS_MORE;
|
|
|
|
|
|
|
|
while (parse_res == simdjson::SUCCESS_AND_HAS_MORE) {
|
|
|
|
parse_res = js.json_parse(pj2);
|
2019-12-17 08:09:18 +08:00
|
|
|
}
|
2019-11-09 06:39:45 +08:00
|
|
|
|
|
|
|
if( ! pj2.is_valid()) {
|
|
|
|
std::cout << "JsonStream not valid" << std::endl;
|
|
|
|
} else {
|
|
|
|
std::cout << "JsonStream valid" << std::endl;
|
|
|
|
}
|
|
|
|
|
|
|
|
|
2018-12-31 10:50:10 +08:00
|
|
|
return EXIT_SUCCESS;
|
|
|
|
}
|
|
|
|
|