1 #include "library/json.hpp"
7 int main(int argc
, char** argv
)
10 bool print_parsed
= false;
12 std::list
<std::string
> files
;
13 for(int i
= 1; i
< argc
; i
++) {
14 std::string opt
= argv
[i
];
19 else if(opt
== "--print")
21 else if(opt
.substr(0, 2) == "--") {
22 std::cerr
<< "Unknown option '" << opt
<< "'" << std::endl
;
31 std::ifstream
strm(i
, std::ios::binary
);
33 throw std::runtime_error("Can't open");
36 std::getline(strm
, line
);
37 doc
= doc
+ line
+ "\n";
42 JSON::printer_indenting ip
;
43 std::cout
<< n
.serialize(&ip
) << std::endl
;
45 } catch(JSON::error
& e
) {
46 std::cerr
<< i
<< ": " << e
.extended_error(doc
) << std::endl
;
48 } catch(std::exception
& e
) {
49 std::cerr
<< i
<< ": " << e
.what() << std::endl
;