diff options
author | David Malcolm <dmalcolm@redhat.com> | 2024-11-18 17:08:36 -0500 |
---|---|---|
committer | David Malcolm <dmalcolm@redhat.com> | 2024-11-18 17:08:36 -0500 |
commit | 66e6e4f131e517344e4f2c16f96de90d391d94e0 (patch) | |
tree | e257cb7132243330d6bd82a95d96618d29e458f3 /gcc/expr.cc | |
parent | 99a909aba3bd26a26f5fb26902559ba20206aa31 (diff) | |
download | gcc-66e6e4f131e517344e4f2c16f96de90d391d94e0.zip gcc-66e6e4f131e517344e4f2c16f96de90d391d94e0.tar.gz gcc-66e6e4f131e517344e4f2c16f96de90d391d94e0.tar.bz2 |
json: add json parsing support
This patch implements JSON parsing support.
It's based on the parsing parts of the patch I posted here:
https://gcc.gnu.org/legacy-ml/gcc-patches/2017-08/msg00417.html
with the parsing moved to a separate source file and header, heavily
rewritten to capture source location information for JSON values, and
to capture errors via a result template.
I also added optional support for C and C++ style comments, which is
extremely useful in DejaGnu tests.
gcc/ChangeLog:
* Makefile.in (OBJS-libcommon): Add json-parsing.o.
* json-parsing.cc: New file.
* json-parsing.h: New file.
* json.cc (selftest::assert_print_eq): Remove "static".
* json.h (json::array::begin): New.
(json::array::end): New.
(json::array::length): New.
(json::array::get): New.
(is_a_helper <json::value *>::test): New.
(is_a_helper <const json::value *>::test): New.
(is_a_helper <json::object *>::test): New.
(is_a_helper <const json::object *>::test): New.
(is_a_helper <json::array *>::test): New.
(is_a_helper <const json::array *>::test): New.
(is_a_helper <json::float_number *>::test): New.
(is_a_helper <const json::float_number *>::test): New.
(is_a_helper <json::integer_number *>::test): New.
(is_a_helper <const json::integer_number *>::test): New.
(is_a_helper <json::string *>::test): New.
(is_a_helper <const json::string *>::test): New.
(selftest::assert_print_eq): New decl.
* selftest-run-tests.cc (selftest::run_tests): Call
selftest::json_parser_cc_tests.
* selftest.h (selftest::json_parser_cc_tests): New decl.
Signed-off-by: David Malcolm <dmalcolm@redhat.com>
Diffstat (limited to 'gcc/expr.cc')
0 files changed, 0 insertions, 0 deletions