1 //
2 // Copyright (c) 2020 Krystian Stasiowski (sdkrystian@gmail.com)
3 //
4 // Distributed under the Boost Software License, Version 1.0. (See accompanying
5 // file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt)
6 //
7 // Official repository: https://github.com/boostorg/json
8 //
9 
10 #ifndef BOOST_JSON_PARSE_OPTIONS_HPP
11 #define BOOST_JSON_PARSE_OPTIONS_HPP
12 
13 #include <boost/json/detail/config.hpp>
14 
15 BOOST_JSON_NS_BEGIN
16 
17 /** Parser options
18 
19     This structure is used for specifying
20     maximum parsing depth, and whether
21     to allow various non-standard extensions.
22     Default-constructed options set maximum
23     parsing depth to 32 and specify that only
24     standard JSON is allowed,
25 
26     @see
27         @ref basic_parser,
28         @ref parser.
29 */
30 struct parse_options
31 {
32     /** Maximum nesting level of arrays and objects.
33 
34         This specifies the maximum number of nested
35         structures allowed while parsing a JSON. If
36         this limit is exceeded during a parse, an
37         error is returned.
38 
39         @see
40             @ref basic_parser,
41             @ref stream_parser.
42     */
43     std::size_t max_depth = 32;
44 
45     /** Non-standard extension option
46 
47         Allow C and C++ style comments to appear
48         anywhere that whitespace is permissible.
49 
50         @see
51             @ref basic_parser,
52             @ref stream_parser.
53     */
54     bool allow_comments = false;
55 
56     /** Non-standard extension option
57 
58         Allow a trailing comma to appear after
59         the last element of any array or object.
60 
61         @see
62             @ref basic_parser,
63             @ref stream_parser.
64     */
65     bool allow_trailing_commas = false;
66 
67     /** Non-standard extension option
68 
69         Allow invalid UTF-8 sequnces to appear
70         in keys and strings.
71 
72         @note This increases parsing performance.
73 
74         @see
75             @ref basic_parser,
76             @ref stream_parser.
77     */
78     bool allow_invalid_utf8 = false;
79 };
80 
81 BOOST_JSON_NS_END
82 
83 #endif
84