diff --git a/CMakeLists.txt b/CMakeLists.txt index 5d5b689..e00db57 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -1,36 +1,34 @@ cmake_minimum_required(VERSION 2.8) -# Check if a supported compiler is used and add c++14 flag: +# Check if a supported compiler is used and add c++11 flag: if(CMAKE_CXX_COMPILER_ID STREQUAL "GNU") if(CMAKE_CXX_COMPILER_VERSION VERSION_LESS 4.9) message(FATAL_ERROR "Need at least gcc 4.9 to compile.") endif() - set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -std=c++14") + set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -std=c++11") elseif(MSVC) if(CMAKE_CXX_COMPILER_VERSION VERSION_LESS 19) message(FATAL_ERROR "Visual Studio 2015 or newer is required.") endif() elseif(CMAKE_CXX_COMPILER_ID STREQUAL "AppleClang") - set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -std=c++14") + if(CMAKE_CXX_COMPILER_VERSION VERSION_LESS 7.0) + message(FATAL_ERROR "Need at least AppleClang 7.0 to compile.") + endif() + set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -std=c++11") elseif(CMAKE_CXX_COMPILER_ID STREQUAL "Clang") if(CMAKE_CXX_COMPILER_VERSION VERSION_LESS 3.4) message(FATAL_ERROR "Clang below version 3.4 will most likely not work. Please upgrade your compiler.") endif() - - if(CMAKE_CXX_COMPILER_VERSION VERSION_LESS 3.6) - set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -std=c++1y") - else() - set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -std=c++14") - endif() + set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -std=c++11") else() # no GNU, no MSVC, no Clang message(WARNING "You are using an unsupported compiler. Compilation has only been tested with MSVC, GCC and Clang.") include(CheckCXXCompilerFlag) - check_cxx_compiler_flag(-std=c++14 HAS_CXX14_FLAG) - if(HAS_CXX14_FLAG) - set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -std=c++14") + check_cxx_compiler_flag(-std=c++11 HAS_CXX11_FLAG) + if(HAS_CXX11_FLAG) + set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -std=c++11") else() - message(FATAL_ERROR "Your compiler doesn't support the '-std=c++14' flag.") + message(FATAL_ERROR "Your compiler doesn't support the '-std=c++11' flag.") endif() endif() @@ -73,4 +71,4 @@ if(NOT MSVC) add_subdirectory(lint) add_subdirectory(language/pl0) add_subdirectory(language/culebra) -endif() \ No newline at end of file +endif() diff --git a/lint/peglint.cc b/lint/peglint.cc index 0a56c87..b590569 100644 --- a/lint/peglint.cc +++ b/lint/peglint.cc @@ -91,7 +91,7 @@ int main(int argc, const char** argv) peg::parser parser; - parser.log = [&](auto ln, auto col, const auto& msg) { + parser.log = [&](size_t ln, size_t col, const string& msg) { cerr << syntax_path << ":" << ln << ":" << col << ": " << msg << endl; }; @@ -114,7 +114,7 @@ int main(int argc, const char** argv) source_path = "[commendline]"; } - parser.log = [&](auto ln, auto col, const auto& msg) { + parser.log = [&](size_t ln, size_t col, const string& msg) { cerr << source_path << ":" << ln << ":" << col << ": " << msg << endl; }; @@ -122,7 +122,13 @@ int main(int argc, const char** argv) std::cout << "pos:lev\trule/ope" << std::endl; std::cout << "-------\t--------" << std::endl; size_t prev_pos = 0; - parser.enable_trace([&](auto name, auto s, auto /*n*/, auto& /*sv*/, auto& c, auto& /*dt*/) { + parser.enable_trace([&]( + const char* name, + const char* s, + size_t /*n*/, + const peg::SemanticValues& /*sv*/, + const peg::Context& c, + const peg::any& /*dt*/) { auto pos = static_cast(s - c.s); auto backtrack = (pos < prev_pos ? "*" : ""); string indent;