Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
12 changed files
with
305 additions
and
193 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,50 @@ | ||
// Copyright (c) 2016 Dr. Colin Hirsch and Daniel Frey | ||
// Please see LICENSE for license or visit https://github.com/taocpp/json/ | ||
|
||
#ifndef TAOCPP_JSON_INCLUDE_SAX_FROM_STRING_HH | ||
#define TAOCPP_JSON_INCLUDE_SAX_FROM_STRING_HH | ||
|
||
#include "../external/pegtl/parse.hh" | ||
|
||
#include "../internal/grammar.hh" | ||
#include "../internal/action.hh" | ||
#include "../internal/control.hh" | ||
|
||
namespace tao | ||
{ | ||
namespace json | ||
{ | ||
namespace sax | ||
{ | ||
template< typename Handler > | ||
inline void from_string( const char * data, const std::size_t size, Handler & handler, const char * source = nullptr, const std::size_t line = 1, const std::size_t column = 0 ) | ||
{ | ||
tao_json_pegtl::input input( line, column, data, data + size, source ? source : __PRETTY_FUNCTION__ ); | ||
tao_json_pegtl::parse_input< internal::grammar, internal::action, internal::control >( input, handler ); | ||
} | ||
|
||
template< typename Handler > | ||
inline void from_string( const char * data, const std::size_t size, Handler & handler, const std::string & source, const std::size_t line = 1, const std::size_t column = 0 ) | ||
{ | ||
sax::from_string( data, size, handler, source.c_str(), line, column ); | ||
} | ||
|
||
template< typename Handler > | ||
inline void from_string( const std::string & data, Handler & handler, const char * source = nullptr, const std::size_t line = 1, const std::size_t column = 0 ) | ||
{ | ||
sax::from_string( data.data(), data.size(), handler, source, line, column ); | ||
} | ||
|
||
template< typename Handler > | ||
inline void from_string( const std::string & data, Handler & handler, const std::string & source, const std::size_t line = 1, const std::size_t column = 0 ) | ||
{ | ||
sax::from_string( data, handler, source.c_str(), line, column ); | ||
} | ||
|
||
} // sax | ||
|
||
} // json | ||
|
||
} // tao | ||
|
||
#endif |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,31 @@ | ||
// Copyright (c) 2016 Dr. Colin Hirsch and Daniel Frey | ||
// Please see LICENSE for license or visit https://github.com/taocpp/json/ | ||
|
||
#ifndef TAOCPP_JSON_INCLUDE_SAX_PARSE_FILE_HH | ||
#define TAOCPP_JSON_INCLUDE_SAX_PARSE_FILE_HH | ||
|
||
#include "../external/pegtl/file_parser.hh" | ||
|
||
#include "../internal/grammar.hh" | ||
#include "../internal/action.hh" | ||
#include "../internal/control.hh" | ||
|
||
namespace tao | ||
{ | ||
namespace json | ||
{ | ||
namespace sax | ||
{ | ||
template< typename Handler > | ||
void parse_file( const std::string & filename, Handler & handler ) | ||
{ | ||
tao_json_pegtl::file_parser( filename ).parse< internal::grammar, internal::action, internal::control >( handler ); | ||
} | ||
|
||
} // sax | ||
|
||
} // json | ||
|
||
} // tao | ||
|
||
#endif |
Oops, something went wrong.