From 9d183603334662bf58a81a37f76ac4a9ff126e9b Mon Sep 17 00:00:00 2001 From: Jason Turner Date: Fri, 2 Oct 2015 12:46:50 -0600 Subject: [PATCH] Older compiler backport issues --- include/chaiscript/language/chaiscript_parser.hpp | 4 ++-- include/chaiscript/utility/json.hpp | 4 +++- include/chaiscript/utility/json_wrap.hpp | 2 +- 3 files changed, 6 insertions(+), 4 deletions(-) diff --git a/include/chaiscript/language/chaiscript_parser.hpp b/include/chaiscript/language/chaiscript_parser.hpp index bd902f1..ddc2111 100644 --- a/include/chaiscript/language/chaiscript_parser.hpp +++ b/include/chaiscript/language/chaiscript_parser.hpp @@ -953,7 +953,7 @@ namespace chaiscript struct Char_Parser { string_type &match; - using char_type = typename string_type::value_type; + typedef typename string_type::value_type char_type; bool is_escaped; bool is_interpolated; bool saw_interpolation_marker; @@ -1084,7 +1084,7 @@ namespace chaiscript std::string match; const auto prev_stack_top = m_match_stack.size(); - bool is_interpolated = [&]() { + bool is_interpolated = [&]()->bool { Char_Parser cparser(match, true); diff --git a/include/chaiscript/utility/json.hpp b/include/chaiscript/utility/json.hpp index e5ba4f7..893f7bf 100644 --- a/include/chaiscript/utility/json.hpp +++ b/include/chaiscript/utility/json.hpp @@ -249,7 +249,7 @@ class JSON SetType( Class::Object ); return Internal.Map->operator[]( key ); } - JSON& operator[]( unsigned index ) { + JSON& operator[]( const size_t index ) { SetType( Class::Array ); if( index >= Internal.List->size() ) Internal.List->resize( index + 1 ); return Internal.List->operator[]( index ); @@ -385,6 +385,8 @@ class JSON case Class::Boolean: return Internal.Bool ? "true" : "false"; } + + throw std::runtime_error("Unhandled JSON type"); } friend std::ostream& operator<<( std::ostream&, const JSON & ); diff --git a/include/chaiscript/utility/json_wrap.hpp b/include/chaiscript/utility/json_wrap.hpp index 1b0631d..d15528f 100644 --- a/include/chaiscript/utility/json_wrap.hpp +++ b/include/chaiscript/utility/json_wrap.hpp @@ -12,7 +12,7 @@ namespace chaiscript static ModulePtr library(ModulePtr m = std::make_shared()) { - m->add(chaiscript::fun([](const std::string &t_str) { return json_wrap::from_json(t_str); }), "from_json"); + m->add(chaiscript::fun([](const std::string &t_str) { return from_json(t_str); }), "from_json"); m->add(chaiscript::fun(&json_wrap::to_json), "to_json"); return m;