make LexerType template arg
This commit is contained in:
parent
760304635d
commit
e5275e30ef
@ -48,14 +48,14 @@ using parser_callback_t =
|
||||
|
||||
This class implements a recursive descent parser.
|
||||
*/
|
||||
template<typename BasicJsonType, typename InputAdapterType>
|
||||
template<template<typename, typename> class LexerType, typename BasicJsonType, typename InputAdapterType>
|
||||
class parser
|
||||
{
|
||||
using number_integer_t = typename BasicJsonType::number_integer_t;
|
||||
using number_unsigned_t = typename BasicJsonType::number_unsigned_t;
|
||||
using number_float_t = typename BasicJsonType::number_float_t;
|
||||
using string_t = typename BasicJsonType::string_t;
|
||||
using lexer_t = lexer<BasicJsonType, InputAdapterType>;
|
||||
using lexer_t = LexerType<BasicJsonType, InputAdapterType>;
|
||||
using token_type = typename lexer_t::token_type;
|
||||
|
||||
public:
|
||||
|
||||
@ -132,12 +132,13 @@
|
||||
class NumberUnsignedType, class NumberFloatType, \
|
||||
template<typename> class AllocatorType, \
|
||||
template<typename, typename = void> class JSONSerializer, \
|
||||
class BinaryType>
|
||||
class BinaryType, \
|
||||
template<typename, typename> class LexerType>
|
||||
|
||||
#define NLOHMANN_BASIC_JSON_TPL \
|
||||
basic_json<ObjectType, ArrayType, StringType, BooleanType, \
|
||||
NumberIntegerType, NumberUnsignedType, NumberFloatType, \
|
||||
AllocatorType, JSONSerializer, BinaryType>
|
||||
AllocatorType, JSONSerializer, BinaryType, LexerType>
|
||||
|
||||
// Macros to simplify conversion from/to types
|
||||
|
||||
|
||||
@ -199,17 +199,17 @@ class basic_json // NOLINT(cppcoreguidelines-special-member-functions,hicpp-spec
|
||||
|
||||
JSON_PRIVATE_UNLESS_TESTED:
|
||||
// convenience aliases for types residing in namespace detail;
|
||||
using lexer = ::nlohmann::detail::lexer_base<basic_json>;
|
||||
// using lexer = ::nlohmann::detail::lexer_base<basic_json>;
|
||||
|
||||
template<typename InputAdapterType>
|
||||
static ::nlohmann::detail::parser<basic_json, InputAdapterType> parser(
|
||||
static ::nlohmann::detail::parser<LexerType, basic_json, InputAdapterType> parser(
|
||||
InputAdapterType adapter,
|
||||
detail::parser_callback_t<basic_json>cb = nullptr,
|
||||
const bool allow_exceptions = true,
|
||||
const bool ignore_comments = false
|
||||
)
|
||||
{
|
||||
return ::nlohmann::detail::parser<basic_json, InputAdapterType>(std::move(adapter),
|
||||
return ::nlohmann::detail::parser<LexerType, basic_json, InputAdapterType>(std::move(adapter),
|
||||
std::move(cb), allow_exceptions, ignore_comments);
|
||||
}
|
||||
|
||||
|
||||
@ -24,6 +24,12 @@ for serialization.
|
||||
template<typename T = void, typename SFINAE = void>
|
||||
struct adl_serializer;
|
||||
|
||||
namespace detail
|
||||
{
|
||||
template<typename BasicJsonType, typename InputAdapterType>
|
||||
class lexer;
|
||||
}
|
||||
|
||||
template<template<typename U, typename V, typename... Args> class ObjectType =
|
||||
std::map,
|
||||
template<typename U, typename... Args> class ArrayType = std::vector,
|
||||
@ -34,7 +40,8 @@ template<template<typename U, typename V, typename... Args> class ObjectType =
|
||||
template<typename U> class AllocatorType = std::allocator,
|
||||
template<typename T, typename SFINAE = void> class JSONSerializer =
|
||||
adl_serializer,
|
||||
class BinaryType = std::vector<std::uint8_t>>
|
||||
class BinaryType = std::vector<std::uint8_t>,
|
||||
template<typename BasicJsonType, typename InputAdapterType> class LexerType = detail::lexer>
|
||||
class basic_json;
|
||||
|
||||
/*!
|
||||
|
||||
Loading…
Reference in New Issue
Block a user