Parser options. This structure is used for specifying maximum parsing depth, and whether to allow various non-standard extensions. Default-constructed options set maximum parsing depth to 32 and specify that only standard JSON is allowed, @see @ref parse, @ref parser, @ref basic_parser. */
| 62 | @see @ref parse, @ref parser, @ref basic_parser. |
| 63 | */ |
| 64 | struct parse_options |
| 65 | { |
| 66 | /** Maximum nesting level of arrays and objects. |
| 67 | |
| 68 | This specifies the maximum number of nested structures allowed while |
| 69 | parsing a JSON text. If this limit is exceeded during a parse, an error |
| 70 | is returned. |
| 71 | |
| 72 | @see @ref basic_parser, @ref stream_parser. |
| 73 | */ |
| 74 | std::size_t max_depth = 32; |
| 75 | |
| 76 | /** Number pasing mode. |
| 77 | |
| 78 | This selects the way to parse numbers. The default is to parse them |
| 79 | fast, but with possible slight imprecision for floating point numbers |
| 80 | with larger mantissas. Users can also choose to parse numbers slower |
| 81 | but with full precision. Or to not parse them at all, and only validate |
| 82 | numbers. The latter mode is useful for @ref basic_parser instantiations |
| 83 | that wish to treat numbers in a custom way. |
| 84 | |
| 85 | @see @ref basic_parser, @ref stream_parser. |
| 86 | */ |
| 87 | number_precision numbers = number_precision::imprecise; |
| 88 | |
| 89 | /** Non-standard extension option. |
| 90 | |
| 91 | Allow C and C++ style comments to appear anywhere that whitespace is |
| 92 | permissible. |
| 93 | |
| 94 | @see @ref basic_parser, @ref stream_parser. |
| 95 | */ |
| 96 | bool allow_comments = false; |
| 97 | |
| 98 | /** Non-standard extension option |
| 99 | |
| 100 | Allow a trailing comma to appear after the last element of any array or |
| 101 | object. |
| 102 | |
| 103 | @see @ref basic_parser, @ref stream_parser. |
| 104 | */ |
| 105 | bool allow_trailing_commas = false; |
| 106 | |
| 107 | /** Non-standard extension option |
| 108 | |
| 109 | Allow invalid UTF-8 sequences to appear in keys and strings. |
| 110 | |
| 111 | @note This increases parsing performance. |
| 112 | |
| 113 | @see @ref basic_parser, @ref stream_parser. |
| 114 | */ |
| 115 | bool allow_invalid_utf8 = false; |
| 116 | |
| 117 | /** Non-standard extension option |
| 118 | |
| 119 | Allow invalid UTF-16 surrogate pairs to appear in strings. When |
| 120 | enabled, the parser will not strictly validate the correctness of |
| 121 | UTF-16 encoding, allowing for the presence of illegal leading or |
no outgoing calls