From 9ecebfee32f97ebaeef05994e1274e03e2b0611a Mon Sep 17 00:00:00 2001 From: Daniel Frey Date: Fri, 19 May 2017 20:43:20 +0200 Subject: [PATCH] Style --- include/tao/json/internal/action.hpp | 5 +++-- include/tao/json/internal/control.hpp | 12 ++++++++---- include/tao/json/internal/errors.hpp | 2 +- include/tao/json/sax/from_stream.hpp | 4 ++-- include/tao/json/sax/from_string.hpp | 4 ++-- include/tao/json/schema.hpp | 21 ++++++++++++++------- 6 files changed, 30 insertions(+), 18 deletions(-) diff --git a/include/tao/json/internal/action.hpp b/include/tao/json/internal/action.hpp index 6fb6c121..0e0cb7c6 100644 --- a/include/tao/json/internal/action.hpp +++ b/include/tao/json/internal/action.hpp @@ -4,7 +4,7 @@ #ifndef TAOCPP_JSON_INCLUDE_INTERNAL_ACTION_HPP #define TAOCPP_JSON_INCLUDE_INTERNAL_ACTION_HPP -#include "../external/pegtl/contrib/changes.hpp" +#include "../external/pegtl/nothing.hpp" #include "errors.hpp" #include "grammar.hpp" @@ -18,7 +18,8 @@ namespace tao namespace internal { template< typename Rule > - struct action : json_pegtl::nothing< Rule > + struct action + : json_pegtl::nothing< Rule > { }; diff --git a/include/tao/json/internal/control.hpp b/include/tao/json/internal/control.hpp index f668654d..97724b7b 100644 --- a/include/tao/json/internal/control.hpp +++ b/include/tao/json/internal/control.hpp @@ -21,22 +21,26 @@ namespace tao namespace internal { template< typename Rule > - struct control : errors< Rule > + struct control + : errors< Rule > { }; template<> - struct control< rules::number > : json_pegtl::change_state< rules::number, number_state, errors > + struct control< rules::number > + : json_pegtl::change_state< rules::number, number_state, errors > { }; template<> - struct control< rules::string::content > : json_pegtl::change_state_and_action< rules::string::content, string_state, unescape_action, errors > + struct control< rules::string::content > + : json_pegtl::change_state_and_action< rules::string::content, string_state, unescape_action, errors > { }; template<> - struct control< rules::key::content > : json_pegtl::change_state_and_action< rules::key::content, key_state, unescape_action, errors > + struct control< rules::key::content > + : json_pegtl::change_state_and_action< rules::key::content, key_state, unescape_action, errors > { }; diff --git a/include/tao/json/internal/errors.hpp b/include/tao/json/internal/errors.hpp index 40f5ce1e..067c716e 100644 --- a/include/tao/json/internal/errors.hpp +++ b/include/tao/json/internal/errors.hpp @@ -27,7 +27,7 @@ namespace tao { template< typename Rule > struct errors - : public json_pegtl::normal< Rule > + : json_pegtl::normal< Rule > { static const std::string error_message; diff --git a/include/tao/json/sax/from_stream.hpp b/include/tao/json/sax/from_stream.hpp index 72978a51..0993e58d 100644 --- a/include/tao/json/sax/from_stream.hpp +++ b/include/tao/json/sax/from_stream.hpp @@ -22,8 +22,8 @@ namespace tao template< typename Consumer > inline void from_stream( std::istream& stream, Consumer& consumer, const char* source = nullptr, const std::size_t maximum_buffer_size = 4000 ) { - json_pegtl::istream_input<> input( stream, maximum_buffer_size, source ? source : "tao::json::sax::from_stream" ); - json_pegtl::parse< internal::grammar, internal::action, internal::control >( input, consumer ); + json_pegtl::istream_input<> in( stream, maximum_buffer_size, source ? source : "tao::json::sax::from_stream" ); + json_pegtl::parse< internal::grammar, internal::action, internal::control >( in, consumer ); } template< typename Consumer > diff --git a/include/tao/json/sax/from_string.hpp b/include/tao/json/sax/from_string.hpp index e80f6959..d0f8e933 100644 --- a/include/tao/json/sax/from_string.hpp +++ b/include/tao/json/sax/from_string.hpp @@ -20,8 +20,8 @@ namespace tao template< typename Consumer > inline void from_string( const char* data, const std::size_t size, Consumer& consumer, const char* source = nullptr, const std::size_t byte = 0, const std::size_t line = 1, const std::size_t column = 0 ) { - json_pegtl::memory_input< json_pegtl::tracking_mode::LAZY, json_pegtl::eol::lf_crlf, const char* > input( data, data + size, source ? source : "tao::json::sax::from_string", byte, line, column ); - json_pegtl::parse< internal::grammar, internal::action, internal::control >( input, consumer ); + json_pegtl::memory_input< json_pegtl::tracking_mode::LAZY, json_pegtl::eol::lf_crlf, const char* > in( data, data + size, source ? source : "tao::json::sax::from_string", byte, line, column ); + json_pegtl::parse< internal::grammar, internal::action, internal::control >( in, consumer ); } template< typename Consumer > diff --git a/include/tao/json/schema.hpp b/include/tao/json/schema.hpp index 49403d1e..e77b5aaa 100644 --- a/include/tao/json/schema.hpp +++ b/include/tao/json/schema.hpp @@ -32,29 +32,36 @@ namespace tao namespace internal { // TODO: Check if these grammars are correct. - struct local_part_label : json_pegtl::plus< json_pegtl::sor< json_pegtl::alnum, json_pegtl::one< '!', '#', '$', '%', '&', '\'', '*', '+', '-', '/', '=', '?', '^', '_', '`', '{', '|', '}', '~' > > > + struct local_part_label + : json_pegtl::plus< json_pegtl::sor< json_pegtl::alnum, json_pegtl::one< '!', '#', '$', '%', '&', '\'', '*', '+', '-', '/', '=', '?', '^', '_', '`', '{', '|', '}', '~' > > > { }; - struct local_part : json_pegtl::list_must< local_part_label, json_pegtl::one< '.' > > + + struct local_part + : json_pegtl::list_must< local_part_label, json_pegtl::one< '.' > > { }; - struct hostname_label : json_pegtl::seq< json_pegtl::alnum, json_pegtl::rep_max< 62, json_pegtl::ranges< 'a', 'z', 'A', 'Z', '0', '9', '-' > > > + struct hostname_label + : json_pegtl::seq< json_pegtl::alnum, json_pegtl::rep_max< 62, json_pegtl::ranges< 'a', 'z', 'A', 'Z', '0', '9', '-' > > > { }; - struct hostname : json_pegtl::list_must< hostname_label, json_pegtl::one< '.' > > + + struct hostname + : json_pegtl::list_must< hostname_label, json_pegtl::one< '.' > > { }; - struct email : json_pegtl::seq< local_part, json_pegtl::one< '@' >, hostname > + struct email + : json_pegtl::seq< local_part, json_pegtl::one< '@' >, hostname > { }; template< typename Rule > bool parse( const std::string& v ) { - json_pegtl::memory_input<> input( v, "" ); - return json_pegtl::parse< json_pegtl::seq< Rule, json_pegtl::eof > >( input ); + json_pegtl::memory_input<> in( v, "" ); + return json_pegtl::parse< json_pegtl::seq< Rule, json_pegtl::eof > >( in ); } inline bool parse_date_time( const std::string& v )