Line data Source code
1 : /* JSON Pointer parsing (RFC 6901).
2 : Copyright (C) 2026 Free Software Foundation, Inc.
3 : Contributed by David Malcolm <dmalcolm@redhat.com>.
4 :
5 : This file is part of GCC.
6 :
7 : GCC is free software; you can redistribute it and/or modify it under
8 : the terms of the GNU General Public License as published by the Free
9 : Software Foundation; either version 3, or (at your option) any later
10 : version.
11 :
12 : GCC is distributed in the hope that it will be useful, but WITHOUT ANY
13 : WARRANTY; without even the implied warranty of MERCHANTABILITY or
14 : FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
15 : for more details.
16 :
17 : You should have received a copy of the GNU General Public License
18 : along with GCC; see the file COPYING3. If not see
19 : <http://www.gnu.org/licenses/>. */
20 :
21 : #ifndef GCC_JSON_POINTER_PARSING_H
22 : #define GCC_JSON_POINTER_PARSING_H
23 :
24 : #include "json.h"
25 : #include "json-parsing.h"
26 : #include "pretty-print-token-buffer.h"
27 :
28 : namespace json {
29 : namespace pointer {
30 :
31 104 : class error
32 : {
33 : public:
34 52 : error (pretty_print_token_buffer tokens)
35 52 : : m_tokens (std::move (tokens))
36 : {
37 : }
38 :
39 : pretty_print_token_buffer m_tokens;
40 : };
41 :
42 : /* Typedef for the result of parsing JSON pointer: borrowed json::value *
43 : or of a json::pointer::error *. */
44 : typedef result<const json::value*,
45 : std::unique_ptr<error>> parser_result_t;
46 :
47 : /* Function for parsing JSON pointer. */
48 :
49 : extern parser_result_t
50 : parse_utf8_string (const char *utf8_json_pointer,
51 : const json::value *root_val);
52 :
53 : } // namespace pointer
54 : } // namespace json
55 :
56 : #endif /* GCC_JSON_POINTER_PARSING_H */
|