diff --git a/.travis.yml b/.travis.yml index b23712e..eaab7ab 100644 --- a/.travis.yml +++ b/.travis.yml @@ -1,5 +1,4 @@ sudo: required -dist: xenial language: cpp @@ -21,24 +20,20 @@ matrix: include: # OSX, xcode 8 - os: osx - osx_image: xcode8 + osx_image: xcode10 env: CMAKE_OPTIONS="-DOVF_BUILD_FORTRAN_BINDINGS=OFF" PYPI=true # Linux, GCC 7 - os: linux - env: COMPILER_C=gcc-7 COMPILER_CXX=g++-7 COMPILER_FORTRAN=gfortran-7 CMAKE_OPTIONS="" PYPI=true + dist: bionic + env: COMPILER_C=gcc COMPILER_CXX=g++ COMPILER_FORTRAN=gfortran CMAKE_OPTIONS="" PYPI=true compiler: g++ addons: apt: packages: - - g++-7 - - gfortran-7 - - ca-certificates - - python2.7 - sources: - - sourceline: 'ppa:ubuntu-toolchain-r/test' - - sourceline: 'ppa:jonathonf/python-2.7' + - gfortran # Linux, GCC 5 - os: linux + dist: xenial env: COMPILER_C=gcc-5 COMPILER_CXX=g++-5 CMAKE_OPTIONS="-DOVF_BUILD_FORTRAN_BINDINGS=OFF" PYPI=false compiler: g++ addons: diff --git a/CMakeLists.txt b/CMakeLists.txt index 2ecdfde..6d6650e 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -8,7 +8,7 @@ set( META_AUTHOR_MAINTAINER "Gideon Mueller" ) set( META_AUTHOR_EMAIL "g.mueller@fz-juelich.de" ) set( META_VERSION_MAJOR "0" ) set( META_VERSION_MINOR "4" ) -set( META_VERSION_PATCH "1" ) +set( META_VERSION_PATCH "2" ) set( META_VERSION "${META_VERSION_MAJOR}.${META_VERSION_MINOR}.${META_VERSION_PATCH}" ) ############################################# @@ -211,4 +211,5 @@ if( OVF_BUILD_TEST AND OVF_BUILD_FORTRAN_BINDINGS ) endif() -set(OVF_LIBRARIES ${PROJECT_NAME} PARENT_SCOPE) \ No newline at end of file +set( OVF_LIBRARIES ${PROJECT_NAME} PARENT_SCOPE ) +set( OVF_LIBRARIES ${PROJECT_NAME}_static PARENT_SCOPE ) \ No newline at end of file diff --git a/README.md b/README.md index 8016d05..7f325bb 100644 --- a/README.md +++ b/README.md @@ -22,7 +22,7 @@ which should tell you what the problem was (`const char * ovf_latest_message(struct ovf_file *)` in the C API). In C/C++ and Fortran, before writing a segment, make sure the `ovf_segment` you pass in is -initialized, i.e. you already called either `ovf_read_segment_header` or `ovf_segment_initialize`. +initialized, i.e. you already called either `ovf_read_segment_header` or `ovf_segment_create`. ### C/C++ @@ -36,14 +36,15 @@ Opening and closing: Reading from a file: -- `struct ovf_segment *segment = ovf_segment_initialize()` to initialize a segment and get the pointer +- `struct ovf_segment *segment = ovf_segment_create()` to initialize a new segment and get the pointer - `ovf_read_segment_header(myfile, index, segment)` to read the header into the segment struct - create float data array of appropriate size... - `ovf_read_segment_data_4(myfile, index, segment, data)` to read the segment data into your float array +- setting `segment->N` before reading allows partial reading of large data segments Writing and appending to a file: -- `struct ovf_segment *segment = ovf_segment_initialize()` to initialize a segment and get the pointer +- `struct ovf_segment *segment = ovf_segment_create()` to initialize a new segment and get the pointer - `segment->n_cells[0] = ...` etc to set data dimensions, title and description, etc. - `ovf_write_segment_4(myfile, segment, data, OVF_FORMAT_TEXT)` to write a file containing the segment header and data - `ovf_append_segment_4(myfile, segment, data, OVF_FORMAT_TEXT)` to append the segment header and data to the file @@ -116,10 +117,21 @@ endif For more information on how to generate modern Fortran bindings, see also https://github.com/MRedies/Interfacing-Fortran + How to embed it into your project --------------------------------- -TODO... +If you are using CMake, it is as simple as cloning this into a subdirectory, +e.g. `thirdparty/ovf` and using it with `add_subdirectory`: + +``` +add_subdirectory( ${PROJECT_SOURCE_DIR}/thirdparty/ovf ) +set( OVF_INCLUDE_DIRS ${PROJECT_SOURCE_DIR}/thirdparty/ovf/include ) +target_include_directories( myproject PRIVATE ${OVF_INCLUDE_DIRS} ) +target_link_libraries( myproject PUBLIC ${OVF_LIBRARIES_STATIC} ) +``` + +If you're not using CMake, you may need to put in some manual work. Build diff --git a/fortran/ovf.f90 b/fortran/ovf.f90 index b84c4c0..906b575 100644 --- a/fortran/ovf.f90 +++ b/fortran/ovf.f90 @@ -6,9 +6,9 @@ module ovf integer, parameter :: OVF_ERROR = -2 integer, parameter :: OVF_INVALID = -3 -integer, parameter :: OVF_FORMAT_BIN = -55 -integer, parameter :: OVF_FORMAT_TEXT = -56 -integer, parameter :: OVF_FORMAT_CSV = -57 +integer, parameter :: OVF_FORMAT_BIN = 0 +integer, parameter :: OVF_FORMAT_TEXT = 3 +integer, parameter :: OVF_FORMAT_CSV = 4 type, bind(c) :: c_ovf_file type(c_ptr) :: filename @@ -275,18 +275,18 @@ subroutine initialize_segment(self) implicit none class(ovf_segment) :: self - type(c_ovf_segment), pointer :: c_segment + type(c_ovf_segment), pointer :: c_segment type(c_ptr) :: c_segment_ptr interface - function ovf_segment_initialize() & - bind ( C, name = "ovf_segment_initialize" ) + function ovf_segment_create() & + bind ( C, name = "ovf_segment_create" ) use, intrinsic :: iso_c_binding - type(c_ptr) :: ovf_segment_initialize - end function ovf_segment_initialize + type(c_ptr) :: ovf_segment_create + end function ovf_segment_create end interface - c_segment_ptr = ovf_segment_initialize() + c_segment_ptr = ovf_segment_create() call c_f_pointer(c_segment_ptr, c_segment) call fill_ovf_segment(c_segment, self) diff --git a/fortran/test/simple.f90 b/fortran/test/simple.f90 index cb83bdc..ae90987 100644 --- a/fortran/test/simple.f90 +++ b/fortran/test/simple.f90 @@ -30,12 +30,11 @@ program main STOP 1 endif - ! Write a file call file%open_file("testfile_f.ovf") + segment%ValueDim = 3 segment%N_Cells = [ 2, 2, 1 ] segment%N = product(segment%N_Cells) - segment%ValueDim = 3 allocate( array_4(3, segment%N) ) array_4 = 0 @@ -55,6 +54,7 @@ program main ! Append to a file array_4(:,:) = 3*array_4(:,:) + segment%Title = "fortran append test" success = file%append_segment(segment, array_4, OVF_FORMAT_TEXT) if ( success == OVF_OK) then write (*,*) "test append_segment succeeded." diff --git a/include/detail/parse.hpp b/include/detail/parse.hpp index d56e58d..c82f10f 100644 --- a/include/detail/parse.hpp +++ b/include/detail/parse.hpp @@ -197,7 +197,7 @@ namespace parse { pegtl::memory_input<> in( file._state->file_contents[index], "" ); const auto p = err.positions.front(); - std::string line = in.line_as_string(p); + std::string line = in.line_at(p); file._state->message_latest = fmt::format( "libovf segment_header: Expected an empty line or a line containing a keyword and a value!" "Found the following line instead:\n\"{}\"", line); @@ -232,6 +232,7 @@ namespace parse if( file.version == 2 ) { + file._state->max_data_index = segment.N*segment.valuedim; success = pegtl::parse< v2::segment_data, v2::ovf_segment_data_action >( in, file, segment, data ); file._state->current_line = 0; file._state->current_column = 0; @@ -276,8 +277,17 @@ namespace parse } catch( ... ) { - file._state->message_latest = "libovf segment_data: unknown exception"; - return OVF_ERROR; + // Make sure it really never crashes + try + { + file._state->message_latest = "libovf segment_data: unknown exception"; + return OVF_ERROR; + } + catch( ... ) + { + std::cerr << "libovf segment_data: unrecoverable error" << '\n'; + return OVF_ERROR; + } } } } diff --git a/include/detail/parse_rules.hpp b/include/detail/parse_rules.hpp index d8be7b5..7100bc4 100644 --- a/include/detail/parse_rules.hpp +++ b/include/detail/parse_rules.hpp @@ -52,6 +52,7 @@ struct parser_state */ std::string message_out="", message_latest=""; + int max_data_index=0; int tmp_idx=0; std::array tmp_vec3 = std::array{0,0,0}; @@ -266,37 +267,34 @@ namespace parse {}; - struct data_float + struct text_value_float : pegtl::seq< opt_plus_minus, decimal_number > {}; - struct segment_data_float - : data_float - {}; struct line_data_txt - : pegtl::plus< pegtl::pad< segment_data_float, pegtl::blank > > + : pegtl::plus< pegtl::pad< text_value_float, pegtl::blank > > {}; struct line_data_csv : pegtl::seq< - pegtl::list< pegtl::pad, pegtl::one<','> >, + pegtl::list< pegtl::pad, pegtl::one<','> >, pegtl::opt< pegtl::pad< pegtl::one<','>, pegtl::blank > > > {}; - struct bin_4_check_value + struct check_value_bin_4 : tao::pegtl::uint32_le::any {}; - struct bin_4_value - : tao::pegtl::uint32_le::any + struct bytes_bin_4 + : pegtl::seq< pegtl::star< pegtl::not_at< pegtl::seq >, pegtl::any > > {}; - struct bin_8_check_value + struct check_value_bin_8 : tao::pegtl::uint64_le::any {}; - struct bin_8_value - : tao::pegtl::uint64_le::any + struct bytes_bin_8 + : pegtl::seq< pegtl::star< pegtl::not_at< pegtl::seq >, pegtl::any > > {}; ////////////////////////////////////////////// @@ -355,11 +353,6 @@ namespace parse : pegtl::seq< pegtl::star>, pegtl::seq< begin, TAO_PEGTL_ISTRING("Segment"), pegtl::eol>, - // pegtl::star>, - // header, - // pegtl::star>, - // pegtl::sor, - // pegtl::star>, pegtl::until>, pegtl::eol > {}; @@ -389,8 +382,6 @@ namespace parse pegtl::star>, header, pegtl::star>, - // pegtl::sor, - // pegtl::star>, pegtl::until>, pegtl::eol > {}; @@ -492,7 +483,6 @@ namespace parse template< typename Input > static void apply( const Input& in, ovf_file & f, ovf_segment & segment ) { - // std::cerr << " keyword: " << in.string() << std::endl; f._state->keyword = in.string(); std::transform(f._state->keyword.begin(), f._state->keyword.end(),f._state->keyword.begin(), ::tolower); } @@ -504,9 +494,7 @@ namespace parse template< typename Input > static void apply( const Input& in, ovf_file & f, ovf_segment & segment ) { - // std::cerr << " value: " << in.string() << std::endl; f._state->value = in.string(); - std::transform(f._state->value.begin(), f._state->value.end(),f._state->value.begin(), ::tolower); } }; @@ -575,116 +563,110 @@ namespace parse } else if( f._state->keyword == "meshtype" ) { + std::string meshtype = f._state->value; + std::transform(meshtype.begin(), meshtype.end(), meshtype.begin(), ::tolower); if( std::string(segment.meshtype) == "" ) { - if( f._state->value != "rectangular" && f._state->value != "irregular" ) + if( meshtype != "rectangular" && meshtype != "irregular" ) throw tao::pegtl::parse_error( fmt::format( - "Invalid meshtype: \"{}\"", f._state->value), in ); - segment.meshtype = strdup(f._state->value.c_str()); + "Invalid meshtype: \"{}\"", meshtype), in ); + segment.meshtype = strdup(meshtype.c_str()); } - else if( segment.meshtype != f._state->value ) + else if( std::string(segment.meshtype) != meshtype ) { throw tao::pegtl::parse_error( fmt::format( "meshtype \"{}\" was specified, but due to other parameters specified before, \"{}\" was expected!", - f._state->value, segment.meshtype), in ); + meshtype, segment.meshtype), in ); } f._state->found_meshtype = true; } else if( f._state->keyword == "xbase" ) { - if( std::string(segment.meshtype) == "" ) - segment.meshtype = strdup("rectangular"); - else if( std::string(segment.meshtype) != "rectangular" ) + if( std::string(segment.meshtype) != "rectangular" ) throw tao::pegtl::parse_error( fmt::format( "xbase is only for rectangular meshes! Mesh type is \"{}\"", segment.meshtype), in ); + segment.meshtype = strdup("rectangular"); segment.origin[0] = std::stof(f._state->value.c_str()); f._state->found_xbase = true; } else if( f._state->keyword == "ybase" ) { - if( std::string(segment.meshtype) == "" ) - segment.meshtype = strdup("rectangular"); - else if( std::string(segment.meshtype) != "rectangular" ) + if( std::string(segment.meshtype) != "rectangular" ) throw tao::pegtl::parse_error( fmt::format( "ybase is only for rectangular meshes! Mesh type is \"{}\"", segment.meshtype), in ); + segment.meshtype = strdup("rectangular"); segment.origin[1] = std::stof(f._state->value.c_str()); f._state->found_ybase = true; } else if( f._state->keyword == "zbase" ) { - if( std::string(segment.meshtype) == "" ) - segment.meshtype = strdup("rectangular"); - else if( std::string(segment.meshtype) != "rectangular" ) + if( std::string(segment.meshtype) != "rectangular" ) throw tao::pegtl::parse_error( fmt::format( "zbase is only for rectangular meshes! Mesh type is \"{}\"", segment.meshtype), in ); + segment.meshtype = strdup("rectangular"); segment.origin[2] = std::stof(f._state->value.c_str()); f._state->found_zbase = true; } else if( f._state->keyword == "xstepsize" ) { - if( std::string(segment.meshtype) == "" ) - segment.meshtype = strdup("rectangular"); - else if( std::string(segment.meshtype) != "rectangular" ) + if( std::string(segment.meshtype) != "rectangular" ) throw tao::pegtl::parse_error( fmt::format( "xstepsize is only for rectangular meshes! Mesh type is \"{}\"", segment.meshtype), in ); + segment.meshtype = strdup("rectangular"); segment.step_size[0] = std::stof(f._state->value.c_str()); f._state->found_xstepsize = true; } else if( f._state->keyword == "ystepsize" ) { - if( std::string(segment.meshtype) == "" ) - segment.meshtype = strdup("rectangular"); - else if( std::string(segment.meshtype) != "rectangular" ) + if( std::string(segment.meshtype) != "rectangular" ) throw tao::pegtl::parse_error( fmt::format( "ystepsize is only for rectangular meshes! Mesh type is \"{}\"", segment.meshtype), in ); + segment.meshtype = strdup("rectangular"); segment.step_size[1] = std::stof(f._state->value.c_str()); f._state->found_ystepsize = true; } else if( f._state->keyword == "zstepsize" ) { - if( std::string(segment.meshtype) == "" ) - segment.meshtype = strdup("rectangular"); - else if( std::string(segment.meshtype) != "rectangular" ) + if( std::string(segment.meshtype) != "rectangular" ) throw tao::pegtl::parse_error( fmt::format( "zstepsize is only for rectangular meshes! Mesh type is \"{}\"", segment.meshtype), in ); + segment.meshtype = strdup("rectangular"); segment.step_size[2] = std::stof(f._state->value.c_str()); f._state->found_zstepsize = true; } else if( f._state->keyword == "xnodes" ) { - if( std::string(segment.meshtype) == "" ) - segment.meshtype = strdup("rectangular"); - else if( std::string(segment.meshtype) != "rectangular" ) + if( std::string(segment.meshtype) != "rectangular" ) throw tao::pegtl::parse_error( fmt::format( "xnodes is only for rectangular meshes! Mesh type is \"{}\"", segment.meshtype), in ); + segment.meshtype = strdup("rectangular"); segment.n_cells[0] = std::stoi(f._state->value.c_str()); f._state->found_xnodes = true; } else if( f._state->keyword == "ynodes" ) { - if( std::string(segment.meshtype) == "" ) - segment.meshtype = strdup("rectangular"); - else if( std::string(segment.meshtype) != "rectangular" ) + if( std::string(segment.meshtype) != "rectangular" ) throw tao::pegtl::parse_error( fmt::format( "ynodes is only for rectangular meshes! Mesh type is \"{}\"", segment.meshtype), in ); + segment.meshtype = strdup("rectangular"); segment.n_cells[1] = std::stoi(f._state->value.c_str()); f._state->found_ynodes = true; } else if( f._state->keyword == "znodes" ) { - if( std::string(segment.meshtype) == "" ) - segment.meshtype = strdup("rectangular"); - else if( std::string(segment.meshtype) != "rectangular" ) + if( std::string(segment.meshtype) != "rectangular" ) throw tao::pegtl::parse_error( fmt::format( "znodes is only for rectangular meshes! Mesh type is \"{}\"", segment.meshtype), in ); + segment.meshtype = strdup("rectangular"); segment.n_cells[2] = std::stoi(f._state->value.c_str()); f._state->found_znodes = true; } else if( f._state->keyword == "pointcount" ) { - if( segment.meshtype != "" && std::string(segment.meshtype) != "irregular" ) + if( std::string(segment.meshtype) != "" && std::string(segment.meshtype) != "irregular" ) throw tao::pegtl::parse_error( fmt::format( "pointcount is only for irregular meshes! Mesh type is \"{}\"", segment.meshtype), in ); + segment.meshtype = strdup("irregular"); segment.pointcount = std::stoi(f._state->value.c_str()); f._state->found_pointcount = true; } @@ -721,18 +703,18 @@ namespace parse struct data_binary_4 : pegtl::seq< begin, TAO_PEGTL_ISTRING("Data Binary 4"), pegtl::eol, - bin_4_check_value, - pegtl::until< pegtl::eol, bin_4_value >, - end, TAO_PEGTL_ISTRING("Data Binary 4"), pegtl::eol + check_value_bin_4, + bytes_bin_4, + pegtl::seq > {}; struct data_binary_8 : pegtl::seq< begin, TAO_PEGTL_ISTRING("Data Binary 8"), pegtl::eol, - bin_8_check_value, - pegtl::until< pegtl::eol, bin_8_value >, - end, TAO_PEGTL_ISTRING("Data Binary 8"), pegtl::eol + check_value_bin_8, + bytes_bin_8, + pegtl::seq > {}; @@ -789,7 +771,7 @@ namespace parse }; template<> - struct ovf_segment_data_action< segment_data_float > + struct ovf_segment_data_action< text_value_float > { template< typename Input, typename scalar > static void apply( const Input& in, ovf_file & f, const ovf_segment & segment, scalar * data ) @@ -803,13 +785,16 @@ namespace parse int idx = col + row*n_cols; - data[idx] = value; - ++f._state->current_column; + if( idx < f._state->max_data_index ) + { + data[idx] = value; + ++f._state->current_column; + } } }; template<> - struct ovf_segment_data_action< bin_4_check_value > + struct ovf_segment_data_action< check_value_bin_4 > { template< typename Input, typename scalar > static void apply( const Input& in, ovf_file & f, const ovf_segment & segment, scalar * data ) @@ -817,35 +802,43 @@ namespace parse std::string bytes = in.string(); uint32_t hex_4b = endian::from_little_32(reinterpret_cast( bytes.c_str() )); - if ( hex_4b != check::val_4b ) + if( hex_4b != check::val_4b ) throw tao::pegtl::parse_error( "the expected binary check value could not be parsed!", in ); } }; template<> - struct ovf_segment_data_action< bin_4_value > + struct ovf_segment_data_action< bytes_bin_4 > { template< typename Input, typename scalar > static void apply( const Input& in, ovf_file & f, const ovf_segment & segment, scalar * data ) { - std::string bytes = in.string(); - uint32_t ivalue = endian::from_little_32(reinterpret_cast( bytes.c_str() )); - float value = *reinterpret_cast( &ivalue ); - - int row = f._state->current_line; - int col = f._state->current_column; - - int n_cols = segment.valuedim; + std::string bytes_str = in.string(); + const uint8_t * bytes = reinterpret_cast( bytes_str.c_str() ); + for( int idx=0; idx < f._state->max_data_index; ++idx ) + { + uint32_t ivalue = endian::from_little_32( &bytes[4*idx] ); + float value = *reinterpret_cast( &ivalue ); - int idx = col + row*n_cols; + if( idx < f._state->max_data_index ) + { + data[idx] = value; + ++f._state->current_column; + } - data[idx] = value; - ++f._state->current_column; + if( f._state->current_column > segment.valuedim ) + { + f._state->current_column = 0; + ++f._state->current_line; + } + } + f._state->current_line = 0; + f._state->current_column = 0; } }; template<> - struct ovf_segment_data_action< bin_8_check_value > + struct ovf_segment_data_action< check_value_bin_8 > { template< typename Input, typename scalar > static void apply( const Input& in, ovf_file & f, const ovf_segment & segment, scalar * data ) @@ -853,30 +846,38 @@ namespace parse std::string bytes = in.string(); uint64_t hex_8b = endian::from_little_64(reinterpret_cast( bytes.c_str() )); - if ( hex_8b != check::val_8b ) + if( hex_8b != check::val_8b ) throw tao::pegtl::parse_error( "the expected binary check value could not be parsed!", in ); } }; template<> - struct ovf_segment_data_action< bin_8_value > + struct ovf_segment_data_action< bytes_bin_8 > { template< typename Input, typename scalar > static void apply( const Input& in, ovf_file & f, const ovf_segment & segment, scalar * data ) { - std::string bytes = in.string(); - uint64_t ivalue = endian::from_little_64(reinterpret_cast( bytes.c_str() )); - double value = *reinterpret_cast( &ivalue ); - - int row = f._state->current_line; - int col = f._state->current_column; - - int n_cols = segment.valuedim; + std::string bytes_str = in.string(); + const uint8_t * bytes = reinterpret_cast( bytes_str.c_str() ); + for( int idx=0; idx < f._state->max_data_index; ++idx ) + { + uint64_t ivalue = endian::from_little_64( &bytes[8*idx] ); + double value = *reinterpret_cast( &ivalue ); - int idx = col + row*n_cols; + if( idx < f._state->max_data_index ) + { + data[idx] = value; + ++f._state->current_column; + } - data[idx] = value; - ++f._state->current_column; + if( f._state->current_column > segment.valuedim ) + { + f._state->current_column = 0; + ++f._state->current_line; + } + } + f._state->current_line = 0; + f._state->current_column = 0; } }; diff --git a/include/detail/write.hpp b/include/detail/write.hpp index 25cfe3c..948b4a6 100644 --- a/include/detail/write.hpp +++ b/include/detail/write.hpp @@ -173,7 +173,8 @@ namespace write template - void append_data_txt_to_string( std::string & output_to_file, const T * vf, int n_cols, int n_rows, const std::string& delimiter = "" ) + void append_data_txt_to_string( std::string & output_to_file, const T * vf, int n_cols, int n_rows, + const std::string& delimiter = "" ) try { for (int row = 0; row < n_rows; ++row) @@ -191,7 +192,7 @@ namespace write template int segment( ovf_file *file, const ovf_segment * segment, const T * vf, - bool write_header, const bool append = false, int format = OVF_FORMAT_BIN8 ) + const bool append = false, int format = OVF_FORMAT_BIN8 ) try { if( file->_state->file_contents.size() > 0 && append ) @@ -239,7 +240,7 @@ namespace write else output_to_file += fmt::format( "# valuelabels: {}\n", segment->valuelabels ); - // TODO: this ovf library does not support mesh units yet + // spatial unit output_to_file += fmt::format( empty_line ); output_to_file += fmt::format( "## Fundamental mesh measurement unit. Treated as a label:\n" ); if( std::string(segment->meshunit) == "" ) @@ -247,6 +248,7 @@ namespace write else output_to_file += fmt::format( "# meshunit: {}\n", segment->meshunit ); + // extent output_to_file += fmt::format( empty_line ); output_to_file += fmt::format( "# xmin: {}\n", segment->bounds_min[0] ); output_to_file += fmt::format( "# ymin: {}\n", segment->bounds_min[1] ); @@ -256,7 +258,7 @@ namespace write output_to_file += fmt::format( "# zmax: {}\n", segment->bounds_max[2] ); output_to_file += fmt::format( empty_line ); - // TODO: this ovf library does not support irregular geometry yet. Write ONLY rectangular mesh + // Type of mesh and further keywords depending on it std::string meshtype = segment->meshtype; if( meshtype == "" ) meshtype = "rectangular"; @@ -290,7 +292,8 @@ namespace write else { file->_state->message_latest = fmt::format( - "write_segment not writing out any data to file \"{}\", because meshtype is invalid: \"{}\". You may want to check the segment you passed in.", + "write_segment not writing out any data to file \"{}\", because meshtype is invalid: \"{}\". " + "You may want to check the segment you passed in.", file->file_name, segment->meshtype); return OVF_ERROR; } @@ -301,7 +304,8 @@ namespace write if( n_cols*n_rows <= 0 ) { file->_state->message_latest = fmt::format( - "write_segment not writing out any data, because n_cols*n_rows={}*{}<=0 for file \"{}\". You may want to check the segment you passed in.", + "write_segment not writing out any data, because n_cols*n_rows={}*{}<=0 for file \"{}\". " + "You may want to check the segment you passed in.", n_cols, n_rows, file->file_name); return OVF_ERROR; } @@ -334,8 +338,13 @@ namespace write append_data_txt_to_string( output_to_file, vf, n_cols, n_rows ); else if ( format == OVF_FORMAT_CSV ) append_data_txt_to_string( output_to_file, vf, n_cols, n_rows, "," ); - // else - // // TODO... + else + { + file->_state->message_latest = fmt::format( + "write_segment not writing out any data, because format \"{}\" is invalid. " + "You may want to check what you passed in.", format); + return OVF_ERROR; + } output_to_file += fmt::format( "# End: Data {}\n", datatype_out ); output_to_file += fmt::format( "# End: Segment\n" ); @@ -348,17 +357,9 @@ namespace write else { file_handle handle(file->file_name, false); - - // If we are not appending or the file does not exists we need to write the top header - // and to turn the file_exists attribute to true so we can append more segments - if( write_header ) - { - file->n_segments = 0; - file->version = 2; - handle.write({top_header_string(), output_to_file}); - } - else - handle.write({output_to_file}); + file->n_segments = 0; + file->version = 2; + handle.write( {top_header_string(), output_to_file} ); } file->found = true; file->is_ovf = true; diff --git a/include/ovf.h b/include/ovf.h index a6b9811..743651d 100644 --- a/include/ovf.h +++ b/include/ovf.h @@ -25,11 +25,11 @@ #define OVF_INVALID -3 /* OVF data formats */ -#define OVF_FORMAT_BIN -53 -#define OVF_FORMAT_BIN4 -54 -#define OVF_FORMAT_BIN8 -55 -#define OVF_FORMAT_TEXT -56 -#define OVF_FORMAT_CSV -57 +#define OVF_FORMAT_BIN 0 +#define OVF_FORMAT_BIN4 1 +#define OVF_FORMAT_BIN8 2 +#define OVF_FORMAT_TEXT 3 +#define OVF_FORMAT_CSV 4 /* all header info on a segment */ struct ovf_segment { @@ -81,8 +81,14 @@ struct ovf_file { /* opening a file will fill the struct and prepare everything for read/write */ DLLEXPORT struct ovf_file * ovf_open(const char *filename); +/* opening a file will fill the struct and prepare everything for read/write */ +DLLEXPORT void ovf_file_initialize(struct ovf_file *, const char *filename); + /* create a default-initialized segment struct */ -DLLEXPORT struct ovf_segment * ovf_segment_initialize(); +DLLEXPORT struct ovf_segment * ovf_segment_create(); + +/* default-initialize the values of a segment struct */ +DLLEXPORT void ovf_segment_initialize(struct ovf_segment *); /* read the geometry info from a segment header */ DLLEXPORT int ovf_read_segment_header(struct ovf_file *, int index, struct ovf_segment *); diff --git a/python/ovf/ovf.py b/python/ovf/ovf.py index 91961f4..fdaf6ff 100644 --- a/python/ovf/ovf.py +++ b/python/ovf/ovf.py @@ -11,11 +11,11 @@ INVALID = -3 ### File formats -FILEFORMAT_BIN = -53 -FILEFORMAT_BIN4 = -54 -FILEFORMAT_BIN8 = -55 -FILEFORMAT_TEXT = -56 -FILEFORMAT_CSV = -57 +FILEFORMAT_BIN = 0 +FILEFORMAT_BIN4 = 1 +FILEFORMAT_BIN8 = 2 +FILEFORMAT_TEXT = 3 +FILEFORMAT_CSV = 4 class ovf_segment(ctypes.Structure): ### Some properties diff --git a/python/setup.py b/python/setup.py index ff08b3e..d13115c 100644 --- a/python/setup.py +++ b/python/setup.py @@ -121,6 +121,7 @@ def run(self): name = NAME, description = find_meta("description"), long_description = read(README), + long_description_content_type = "text/markdown", license = find_meta("license"), url = find_meta("uri"), version = find_meta("version")+version_suffix, diff --git a/python/test/binary.py b/python/test/binary.py index 06e5602..bb0b60f 100644 --- a/python/test/binary.py +++ b/python/test/binary.py @@ -21,8 +21,8 @@ def test_write_bin(self): segment = ovf.ovf_segment( title="python write test", comment="more details in this comment...", - n_cells=[2,2,1], - valuedim=3) + valuedim=3, + n_cells=[2,2,1]) success = ovf_file.write_segment(segment, data, fileformat=ovf.FILEFORMAT_BIN) if success != ovf.OK: print("write_segment failed: ", ovf_file.get_latest_message()) @@ -76,8 +76,8 @@ def test_write_mixed(self): segment = ovf.ovf_segment( title="python write test", comment="more details in this comment...", - n_cells=[2,2,1], - valuedim=3) + valuedim=3, + n_cells=[2,2,1]) success = ovf_file.write_segment(segment, data, fileformat=ovf.FILEFORMAT_BIN) if success != ovf.OK: print("write_segment failed: ", ovf_file.get_latest_message()) diff --git a/src/ovf.cpp b/src/ovf.cpp index 38647a9..5303243 100644 --- a/src/ovf.cpp +++ b/src/ovf.cpp @@ -4,17 +4,17 @@ #include #include -struct ovf_file* ovf_open(const char *filename) + +void ovf_file_initialize(struct ovf_file * ovf_file_ptr, const char * filename) try { // Initialize the struct - struct ovf_file * ovf_file_ptr = new ovf_file{ - /*file_name*/ strdup(filename), - /*version*/ 0, - /*found*/ false, - /*is_ovf*/ false, - /*n_segments*/ 0, - /*handle*/ new parser_state }; + ovf_file_ptr->file_name = strdup(filename); + ovf_file_ptr->version = 0, + ovf_file_ptr->found = false; + ovf_file_ptr->is_ovf = false; + ovf_file_ptr->n_segments = 0; + ovf_file_ptr->_state = new parser_state; // Check if the file exists std::fstream filestream( filename ); @@ -24,7 +24,18 @@ try // Parse the overall header and do the initial parse of segments if( ovf_file_ptr->found ) ovf::detail::parse::initial(*ovf_file_ptr); +} +catch( ... ) +{ +} + +struct ovf_file * ovf_open(const char * filename) +try +{ + // Initialize the struct + struct ovf_file * ovf_file_ptr = new ovf_file; + ovf_file_initialize(ovf_file_ptr, filename); return ovf_file_ptr; } catch( ... ) @@ -33,28 +44,45 @@ catch( ... ) } -struct ovf_segment * ovf_segment_initialize() +void ovf_segment_initialize(struct ovf_segment * ovf_segment_ptr) try { - struct ovf_segment * ovf_segment_ptr = new ovf_segment - { - const_cast(""), // title - const_cast(""), // comment - 0, // valuedim - const_cast(""), // valueunits - const_cast(""), // valuelabels - const_cast(""), // meshtype - const_cast(""), // meshunit - 0, // pointcount - {0,0,0}, // n_cells - 0, // N - {0,0,0}, // step_size - {0,0,0}, // bounds_min - {0,0,0}, // bounds_max - 0, // lattice_constant - {0,0,0} // origin - }; + ovf_segment_ptr->title = const_cast(""); + ovf_segment_ptr->comment = const_cast(""); + ovf_segment_ptr->valuedim = 0; + ovf_segment_ptr->valueunits = const_cast(""); + ovf_segment_ptr->valuelabels = const_cast(""); + ovf_segment_ptr->meshtype = const_cast(""); + ovf_segment_ptr->meshunit = const_cast(""); + ovf_segment_ptr->pointcount = 0; + ovf_segment_ptr->n_cells[0] = 0; + ovf_segment_ptr->n_cells[1] = 0; + ovf_segment_ptr->n_cells[2] = 0; + ovf_segment_ptr->N = 0; + ovf_segment_ptr->step_size[0] = 0; + ovf_segment_ptr->step_size[1] = 0; + ovf_segment_ptr->step_size[2] = 0; + ovf_segment_ptr->bounds_min[0] = 0; + ovf_segment_ptr->bounds_min[1] = 0; + ovf_segment_ptr->bounds_min[2] = 0; + ovf_segment_ptr->bounds_max[0] = 0; + ovf_segment_ptr->bounds_max[1] = 0; + ovf_segment_ptr->bounds_max[2] = 0; + ovf_segment_ptr->lattice_constant = 0; + ovf_segment_ptr->origin[0] = 0; + ovf_segment_ptr->origin[1] = 0; + ovf_segment_ptr->origin[2] = 0; +} +catch( ... ) +{ +} + +struct ovf_segment * ovf_segment_create() +try +{ + struct ovf_segment * ovf_segment_ptr = new ovf_segment; + ovf_segment_initialize(ovf_segment_ptr); return ovf_segment_ptr; } catch( ... ) @@ -75,9 +103,6 @@ try if( !segment->title ) return false; - if( !segment->origin ) - return false; - return true; } catch( ... ) @@ -85,6 +110,7 @@ catch( ... ) return false; } + int ovf_read_segment_header(struct ovf_file * ovf_file_ptr, int index, struct ovf_segment *segment) try { @@ -304,7 +330,7 @@ try return OVF_ERROR; } - int retcode = ovf::detail::write::segment(ovf_file_ptr, segment, data, true, false, format); + int retcode = ovf::detail::write::segment(ovf_file_ptr, segment, data, false, format); if (retcode != OVF_OK) ovf_file_ptr->_state->message_latest += "\novf_write_segment_4 failed."; return retcode; @@ -355,7 +381,7 @@ try return OVF_ERROR; } - int retcode = ovf::detail::write::segment(ovf_file_ptr, segment, data, true, false, format); + int retcode = ovf::detail::write::segment(ovf_file_ptr, segment, data, false, format); if (retcode != OVF_OK) ovf_file_ptr->_state->message_latest += "\novf_write_segment_8 failed."; return retcode; @@ -393,7 +419,7 @@ try return OVF_ERROR; } - if( !ovf_file_ptr->is_ovf ) + if( ovf_file_ptr->found && !ovf_file_ptr->is_ovf ) { ovf_file_ptr->_state->message_latest = "libovf ovf_append_segment_4: file is not ovf..."; return OVF_ERROR; @@ -412,8 +438,8 @@ try return OVF_ERROR; } - bool write_header = !ovf_file_ptr->found; - int retcode = ovf::detail::write::segment(ovf_file_ptr, segment, data, write_header, true, format); + bool append = ovf_file_ptr->found; + int retcode = ovf::detail::write::segment(ovf_file_ptr, segment, data, append, format); if (retcode != OVF_OK) ovf_file_ptr->_state->message_latest += "\novf_append_segment_4 failed."; return retcode; @@ -455,7 +481,7 @@ try format == OVF_FORMAT_BIN4 ) format = OVF_FORMAT_BIN; - if( !ovf_file_ptr->is_ovf ) + if( ovf_file_ptr->found && !ovf_file_ptr->is_ovf ) { ovf_file_ptr->_state->message_latest = "libovf ovf_append_segment_8: file is not ovf..."; return OVF_ERROR; @@ -470,8 +496,8 @@ try return OVF_ERROR; } - bool write_header = !ovf_file_ptr->found; - int retcode = ovf::detail::write::segment(ovf_file_ptr, segment, data, write_header, true, format); + bool append = ovf_file_ptr->found; + int retcode = ovf::detail::write::segment(ovf_file_ptr, segment, data, append, format); if (retcode != OVF_OK) ovf_file_ptr->_state->message_latest += "\novf_append_segment_8 failed."; return retcode; @@ -498,7 +524,7 @@ catch( ... ) } -int ovf_close(struct ovf_file *ovf_file_ptr) +int ovf_close(struct ovf_file * ovf_file_ptr) try { if( !ovf_file_ptr ) @@ -506,7 +532,6 @@ try if( !ovf_file_ptr->_state ) return OVF_ERROR; delete(ovf_file_ptr->_state); - delete(ovf_file_ptr); return OVF_OK; } catch( ... ) diff --git a/test/binary.cpp b/test/binary.cpp index fdd2eb6..a1e8337 100644 --- a/test/binary.cpp +++ b/test/binary.cpp @@ -12,7 +12,7 @@ TEST_CASE( "Binary", "[binary]" ) SECTION( "write" ) { // segment header - auto segment = ovf_segment_initialize(); + auto segment = ovf_segment_create(); // segment->title = const_cast("ovf test title - write"); // segment->comment = const_cast("test write"); segment->valuedim = 3; @@ -44,7 +44,7 @@ TEST_CASE( "Binary", "[binary]" ) SECTION( "append" ) { // segment header - auto segment = ovf_segment_initialize(); + auto segment = ovf_segment_create(); // segment->title = const_cast("ovf test title - append"); // segment->comment = const_cast("test append"); segment->valuedim = 3; @@ -76,7 +76,7 @@ TEST_CASE( "Binary", "[binary]" ) SECTION( "read first segment" ) { // segment header - auto segment = ovf_segment_initialize(); + auto segment = ovf_segment_create(); // open auto file = ovf_open(testfile); @@ -111,7 +111,7 @@ TEST_CASE( "Binary", "[binary]" ) SECTION( "read second segment") { // segment header - auto segment = ovf_segment_initialize(); + auto segment = ovf_segment_create(); // open auto file = ovf_open(testfile); @@ -151,7 +151,7 @@ TEST_CASE( "Mixed binary and CSV", "[mixed]" ) SECTION( "write" ) { // segment header - auto segment = ovf_segment_initialize(); + auto segment = ovf_segment_create(); segment->title = const_cast("ovf test title - write"); segment->comment = const_cast("test write csv"); segment->valuedim = 3; @@ -186,7 +186,7 @@ TEST_CASE( "Mixed binary and CSV", "[mixed]" ) SECTION( "append" ) { // segment header - auto segment = ovf_segment_initialize(); + auto segment = ovf_segment_create(); // segment->title = const_cast("ovf test title - append"); // segment->comment = const_cast("test append"); segment->valuedim = 3; @@ -218,7 +218,7 @@ TEST_CASE( "Mixed binary and CSV", "[mixed]" ) SECTION( "append" ) { // segment header - auto segment = ovf_segment_initialize(); + auto segment = ovf_segment_create(); // segment->title = const_cast("ovf test title - append"); // segment->comment = const_cast("test append"); segment->valuedim = 3; @@ -250,7 +250,7 @@ TEST_CASE( "Mixed binary and CSV", "[mixed]" ) SECTION( "read first segment" ) { // segment header - auto segment = ovf_segment_initialize(); + auto segment = ovf_segment_create(); // open auto file = ovf_open(testfile); @@ -287,7 +287,7 @@ TEST_CASE( "Mixed binary and CSV", "[mixed]" ) SECTION( "read second segment") { // segment header - auto segment = ovf_segment_initialize(); + auto segment = ovf_segment_create(); // open auto file = ovf_open(testfile); diff --git a/test/simple.cpp b/test/simple.cpp index 5ff796d..54cec8e 100644 --- a/test/simple.cpp +++ b/test/simple.cpp @@ -23,7 +23,7 @@ TEST_CASE( "Write", "[write]" ) SECTION( "write" ) { // segment header - auto segment = ovf_segment_initialize(); + auto segment = ovf_segment_create(); segment->title = const_cast("ovf test title - write"); segment->comment = const_cast("test write"); segment->valuedim = 3; @@ -55,7 +55,7 @@ TEST_CASE( "Write", "[write]" ) SECTION( "append" ) { // segment header - auto segment = ovf_segment_initialize(); + auto segment = ovf_segment_create(); segment->title = const_cast("ovf test title - append"); segment->comment = const_cast("test append"); segment->valuedim = 3; @@ -87,7 +87,7 @@ TEST_CASE( "Write", "[write]" ) SECTION( "append irregular" ) { // segment header - auto segment = ovf_segment_initialize(); + auto segment = ovf_segment_create(); segment->title = const_cast("ovf test title - append irregular mesh"); segment->comment = const_cast("an irregular mesh has different keywords than a rectangular one"); segment->valuedim = 3; @@ -129,7 +129,7 @@ TEST_CASE( "Read", "[read]" ) int index = 0; // segment header - auto segment = ovf_segment_initialize(); + auto segment = ovf_segment_create(); // read header int success = ovf_read_segment_header(file, index, segment); @@ -165,7 +165,7 @@ TEST_CASE( "Read", "[read]" ) int index = 1; // segment header - auto segment = ovf_segment_initialize(); + auto segment = ovf_segment_create(); // read header int success = ovf_read_segment_header(file, index, segment); @@ -201,7 +201,7 @@ TEST_CASE( "Read", "[read]" ) int index = 2; // segment header - auto segment = ovf_segment_initialize(); + auto segment = ovf_segment_create(); // read header int success = ovf_read_segment_header(file, index, segment); diff --git a/thirdparty/PEGTL/LICENSE b/thirdparty/PEGTL/LICENSE old mode 100644 new mode 100755 index 84bd84a..378c177 --- a/thirdparty/PEGTL/LICENSE +++ b/thirdparty/PEGTL/LICENSE @@ -1,6 +1,6 @@ The MIT License (MIT) -Copyright (c) 2007-2018 Dr. Colin Hirsch and Daniel Frey +Copyright (c) 2007-2019 Dr. Colin Hirsch and Daniel Frey Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal diff --git a/thirdparty/PEGTL/README.md b/thirdparty/PEGTL/README.md old mode 100644 new mode 100755 index 150ea9e..ca0bf11 --- a/thirdparty/PEGTL/README.md +++ b/thirdparty/PEGTL/README.md @@ -2,17 +2,17 @@ [![Release](https://img.shields.io/github/release/taocpp/PEGTL.svg)](https://github.com/taocpp/PEGTL/releases/latest) [![Download](https://api.bintray.com/packages/taocpp/public-conan/pegtl%3Ataocpp/images/download.svg)](https://bintray.com/taocpp/public-conan/pegtl%3Ataocpp/_latestVersion) -[![TravisCI](https://travis-ci.org/taocpp/PEGTL.svg?branch=master)](https://travis-ci.org/taocpp/PEGTL) -[![AppVeyor](https://ci.appveyor.com/api/projects/status/pa5sbnw68tu650aq/branch/master?svg=true)](https://ci.appveyor.com/project/taocpp/PEGTL) -[![Doozer.io](https://doozer.io/badge/taocpp/PEGTL/buildstatus/master)](https://doozer.io/user/taocpp/PEGTL) -[![Coverage](https://coveralls.io/repos/github/taocpp/PEGTL/badge.svg?branch=master)](https://coveralls.io/github/taocpp/PEGTL) +[![TravisCI](https://travis-ci.org/taocpp/PEGTL.svg?branch=2.x)](https://travis-ci.org/taocpp/PEGTL) +[![AppVeyor](https://ci.appveyor.com/api/projects/status/pa5sbnw68tu650aq/branch/2.x?svg=true)](https://ci.appveyor.com/project/taocpp/PEGTL) +[![Coverage](https://coveralls.io/repos/github/taocpp/PEGTL/badge.svg?branch=2.x)](https://coveralls.io/github/taocpp/PEGTL) +[![Language grade: C/C++](https://img.shields.io/lgtm/grade/cpp/g/taocpp/PEGTL.svg)](https://lgtm.com/projects/g/taocpp/PEGTL/context:cpp) -The Parsing Expression Grammar Template Library (PEGTL) is a zero-dependency C++11 header-only parser combinator library for creating parsers according to a [Parsing Expression Grammar](http://en.wikipedia.org/wiki/Parsing_expression_grammar) (PEG). +The Parsing Expression Grammar Template Library (PEGTL) is a zero-dependency C++ header-only parser combinator library for creating parsers according to a [Parsing Expression Grammar](http://en.wikipedia.org/wiki/Parsing_expression_grammar) (PEG). ## Documentation * [Version 2.x Documentation](doc/README.md) -* [Version 1.3 Documentation](https://github.com/taocpp/PEGTL/blob/1.3.x/doc/README.md) +* [Version 1.x Documentation](https://github.com/taocpp/PEGTL/blob/1.x/doc/README.md) ## Introduction @@ -25,13 +25,15 @@ Here is an example of how a PEG grammar rule is implemented as C++ class with th // PEG rule for integers consisting of a non-empty // sequence of digits with an optional sign: -// integer ::= ( '+' / '-' )? digit+ +// sign ::= '+' / '-' +// integer ::= sign? digit+ // The same parsing rule implemented with the PEGTL: using namespace tao::pegtl; -struct integer : seq< opt< one< '+', '-' > >, plus< digit > > {}; +struct sign : one< '+', '-' > {}; +struct integer : seq< opt< sign >, plus< digit > > {}; ``` PEGs are superficially similar to Context-Free Grammars (CFGs), however the more deterministic nature of PEGs gives rise to some very important differences. @@ -59,6 +61,7 @@ Each commit is automatically tested with multiple architectures, operating syste * Visual Studio 2015 (x86, x64) * Visual Studio 2017 (x86, x64) + * Visual Studio 2019 (x86, x64) * MinGW (i686), GCC 5.x * MinGW-w64 (i686), GCC 5.x, 6.x * MinGW-w64 (x86_64), GCC 6.x @@ -69,28 +72,19 @@ Each commit is automatically tested with multiple architectures, operating syste * Mac OS X 10.11, Xcode 7.3 * macOS 10.12, Xcode 8.3 * macOS 10.13, Xcode 9.4 + * macOS 10.14, Xcode 10.2 -* Linux (using libstdc++) +* Ubuntu 12.04 LTS (using libstdc++) - * Debian 8 (i386), GCC 4.9 - * Ubuntu 12.04 LTS (amd64), Clang 3.4, 3.7 - * Ubuntu 14.04 LTS (amd64), GCC 4.8, 4.9, 5.x, 6.x, 7.x, 8.x - * Ubuntu 14.04 LTS (amd64), Clang 3.5, 3.6, 3.8, 3.9, 4.x, 5.x, 6.x - * Ubuntu 14.04 LTS (i386, amd64), GCC 4.8 - * Ubuntu 16.04 LTS (i386, amd64, armhf, arm64), GCC 5.x - * Fedora 24 (x86_64), GCC 6.x - * Fedora 24 (x86_64), Clang 3.8 + * Clang 3.4 -* Android +* Ubuntu 16.04 LTS (using libstdc++) - * Android 4.4 "KitKat" (API level 19) - * Android 5.1 "Lollipop" (API level 22) - * Android 6.0 "Marshmellow" (API level 23) - * Android 7.0 "Nougat" (API level 24) + * GCC 4.8, 4.9, 5.x, 6.x, 7.x, 8.x, 9.x + * Clang 3.5, 3.6, 3.8, 3.9, 4.x, 5.x, 6.x, 7.x, 8.x -Additionally, each commit is checked with GCC's and Clang's sanitizers, as well as [`valgrind`](http://valgrind.org/) -and [`clang-tidy`](http://clang.llvm.org/extra/clang-tidy/). Code coverage is automatically measured and the unit tests -cover 100% of the core library code (for releases). +Additionally, each commit is checked with Clang's [Static Analyzer](https://clang-analyzer.llvm.org/), GCC's and Clang's [sanitizers](https://github.com/google/sanitizers), [`clang-tidy`](http://clang.llvm.org/extra/clang-tidy/), and [`valgrind`](http://valgrind.org/). +Code coverage is automatically measured and the unit tests cover 100% of the core library code (for releases). [Releases](https://github.com/taocpp/PEGTL/releases) are done in accordance with [Semantic Versioning](http://semver.org/). Incompatible API changes are *only* allowed to occur between major versions. @@ -98,33 +92,58 @@ For details see the [changelog](doc/Changelog.md). ## Thank You -* Christopher Diggins and the YARD parser for the general idea. -* George Makrydakis for the [inspiration](https://github.com/irrequietus/typestring) to `TAO_PEGTL_STRING`. -* Johannes Overmann for his invaluable [`streplace`](https://code.google.com/p/streplace/) command-line tool. -* Jörg-Christian Böhme for improving the Android CI build. -* Kai Wolf for help with CMake. -* Kenneth Geisshirt for Android compatibility and Android CI. -* Kuzma Shapran for EOL testing and fixes. -* Michael Becker for help with CMake. -* Paul Le Roux for CMake improvements and Conan support. -* Paulo Custodio for Windows-related fixes. -* Sam Hocevar for contributing Visual Studio 2015 compatibility. -* Stephan Beal for the bug reports, suggestions and discussions. -* Stuart Dootson for `mmap_input<>` support on Windows. -* Sven Johannsen for help with CMake. -* Zhihao Yuan for fixing several warnings when compiling with Visual Studio 2015. - -## Contact +In appreciation of all contributions here are the people that have [directly contributed](https://github.com/taocpp/PEGTL/graphs/contributors) to the PEGTL and/or its development. + +[andoma](https://github.com/andoma) +[Bjoe](https://github.com/Bjoe) +[bwagner](https://github.com/bwagner) +[cdiggins](https://github.com/cdiggins) +[delpinux](https://github.com/delpinux) +[dkopecek](https://github.com/dkopecek) +[irrequietus](https://github.com/irrequietus) +[jedelbo](https://github.com/jedelbo) +[joelfrederico](https://github.com/joelfrederico) +[johelegp](https://github.com/johelegp) +[jovermann](https://github.com/jovermann) +[kneth](https://github.com/kneth) +[kuzmas](https://github.com/kuzmas) +[lambdafu](https://github.com/lambdafu) +[lichray](https://github.com/lichray) +[michael-brade](https://github.com/michael-brade) +[mkrupcale](https://github.com/mkrupcale) +[NewProggie](https://github.com/NewProggie) +[ohanar](https://github.com/ohanar) +[pauloscustodio](https://github.com/pauloscustodio) +[pleroux0](https://github.com/pleroux0) +[quadfault](https://github.com/quadfault) +[robertcampion](https://github.com/robertcampion) +[samhocevar](https://github.com/samhocevar) +[sanssecours](https://github.com/sanssecours) +[sgbeal](https://github.com/sgbeal) +[skyrich62](https://github.com/skyrich62) +[studoot](https://github.com/studoot) +[SvenJo](https://github.com/SvenJo) +[wickedmic](https://github.com/wickedmic) +[wravery](https://github.com/wravery) +[zhihaoy](https://github.com/zhihaoy) + +## The Art of C++ The PEGTL is part of [The Art of C++](https://taocpp.github.io/). -For questions and suggestions regarding the PEGTL, success or failure stories, and any other kind of feedback, please feel free to contact the authors at `taocpp(at)icemx.net`. +[ColinH](https://github.com/ColinH) +[d-frey](https://github.com/d-frey) +[uilianries](https://github.com/uilianries) + +## Contact + +For questions and suggestions regarding the PEGTL, success or failure stories, and any other kind of feedback, please feel free to open an issue or a PR on GitHub or contact the authors at `taocpp(at)icemx.net`. ## License The PEGTL is certified [Open Source](http://www.opensource.org/docs/definition.html) software. It may be used for any purpose, including commercial purposes, at absolutely no cost. It is distributed under the terms of the [MIT license](http://www.opensource.org/licenses/mit-license.html) reproduced here. -> Copyright (c) 2007-2018 Dr. Colin Hirsch and Daniel Frey +> Copyright (c) 2007-2019 Dr. Colin Hirsch and Daniel Frey > > Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions: > diff --git a/thirdparty/PEGTL/include/tao/pegtl.hpp b/thirdparty/PEGTL/include/tao/pegtl.hpp old mode 100644 new mode 100755 index 993dfc1..832fc9e --- a/thirdparty/PEGTL/include/tao/pegtl.hpp +++ b/thirdparty/PEGTL/include/tao/pegtl.hpp @@ -1,4 +1,4 @@ -// Copyright (c) 2014-2018 Dr. Colin Hirsch and Daniel Frey +// Copyright (c) 2014-2019 Dr. Colin Hirsch and Daniel Frey // Please see LICENSE for license or visit https://github.com/taocpp/PEGTL/ #ifndef TAO_PEGTL_HPP @@ -7,8 +7,9 @@ #include "pegtl/config.hpp" #include "pegtl/version.hpp" -#include "pegtl/ascii.hpp" #include "pegtl/parse.hpp" + +#include "pegtl/ascii.hpp" #include "pegtl/rules.hpp" #include "pegtl/uint16.hpp" #include "pegtl/uint32.hpp" @@ -21,12 +22,29 @@ #include "pegtl/argv_input.hpp" #include "pegtl/buffer_input.hpp" #include "pegtl/cstream_input.hpp" -#include "pegtl/file_input.hpp" #include "pegtl/istream_input.hpp" #include "pegtl/memory_input.hpp" #include "pegtl/read_input.hpp" #include "pegtl/string_input.hpp" +// this has to be included *after* the above inputs, +// otherwise the amalgamated header will not work! +#include "pegtl/file_input.hpp" + +#include "pegtl/change_action.hpp" +#include "pegtl/change_action_and_state.hpp" +#include "pegtl/change_action_and_states.hpp" +#include "pegtl/change_control.hpp" +#include "pegtl/change_state.hpp" +#include "pegtl/change_states.hpp" + +#include "pegtl/disable_action.hpp" +#include "pegtl/enable_action.hpp" + +#include "pegtl/discard_input.hpp" +#include "pegtl/discard_input_on_failure.hpp" +#include "pegtl/discard_input_on_success.hpp" + // The following are not included by // default because they include . diff --git a/thirdparty/PEGTL/include/tao/pegtl/analysis/analyze_cycles.hpp b/thirdparty/PEGTL/include/tao/pegtl/analysis/analyze_cycles.hpp old mode 100644 new mode 100755 index e25f3bb..697023f --- a/thirdparty/PEGTL/include/tao/pegtl/analysis/analyze_cycles.hpp +++ b/thirdparty/PEGTL/include/tao/pegtl/analysis/analyze_cycles.hpp @@ -1,4 +1,4 @@ -// Copyright (c) 2014-2018 Dr. Colin Hirsch and Daniel Frey +// Copyright (c) 2014-2019 Dr. Colin Hirsch and Daniel Frey // Please see LICENSE for license or visit https://github.com/taocpp/PEGTL/ #ifndef TAO_PEGTL_ANALYSIS_ANALYZE_CYCLES_HPP @@ -56,28 +56,28 @@ namespace tao } if( const auto g = make_insert_guard( m_stack, start->first ) ) { switch( start->second.type ) { - case rule_type::ANY: { + case rule_type::any: { bool a = false; for( const auto& r : start->second.rules ) { a = a || work( find( r ), accum || a ); } return m_cache[ start->first ] = true; } - case rule_type::OPT: { + case rule_type::opt: { bool a = false; for( const auto& r : start->second.rules ) { a = a || work( find( r ), accum || a ); } return m_cache[ start->first ] = false; } - case rule_type::SEQ: { + case rule_type::seq: { bool a = false; for( const auto& r : start->second.rules ) { a = a || work( find( r ), accum || a ); } return m_cache[ start->first ] = a; } - case rule_type::SOR: { + case rule_type::sor: { bool a = true; for( const auto& r : start->second.rules ) { a = a && work( find( r ), accum ); diff --git a/thirdparty/PEGTL/include/tao/pegtl/analysis/counted.hpp b/thirdparty/PEGTL/include/tao/pegtl/analysis/counted.hpp old mode 100644 new mode 100755 index 6dff5b9..e23bcc7 --- a/thirdparty/PEGTL/include/tao/pegtl/analysis/counted.hpp +++ b/thirdparty/PEGTL/include/tao/pegtl/analysis/counted.hpp @@ -1,4 +1,4 @@ -// Copyright (c) 2014-2018 Dr. Colin Hirsch and Daniel Frey +// Copyright (c) 2014-2019 Dr. Colin Hirsch and Daniel Frey // Please see LICENSE for license or visit https://github.com/taocpp/PEGTL/ #ifndef TAO_PEGTL_ANALYSIS_COUNTED_HPP @@ -6,6 +6,8 @@ #include "../config.hpp" +#include + #include "generic.hpp" namespace tao @@ -14,9 +16,9 @@ namespace tao { namespace analysis { - template< rule_type Type, unsigned Count, typename... Rules > + template< rule_type Type, std::size_t Count, typename... Rules > struct counted - : generic< ( Count != 0 ) ? Type : rule_type::OPT, Rules... > + : generic< ( Count != 0 ) ? Type : rule_type::opt, Rules... > { }; diff --git a/thirdparty/PEGTL/include/tao/pegtl/analysis/generic.hpp b/thirdparty/PEGTL/include/tao/pegtl/analysis/generic.hpp old mode 100644 new mode 100755 index 9c0f4e6..d9ee3a7 --- a/thirdparty/PEGTL/include/tao/pegtl/analysis/generic.hpp +++ b/thirdparty/PEGTL/include/tao/pegtl/analysis/generic.hpp @@ -1,4 +1,4 @@ -// Copyright (c) 2014-2018 Dr. Colin Hirsch and Daniel Frey +// Copyright (c) 2014-2019 Dr. Colin Hirsch and Daniel Frey // Please see LICENSE for license or visit https://github.com/taocpp/PEGTL/ #ifndef TAO_PEGTL_ANALYSIS_GENERIC_HPP diff --git a/thirdparty/PEGTL/include/tao/pegtl/analysis/grammar_info.hpp b/thirdparty/PEGTL/include/tao/pegtl/analysis/grammar_info.hpp old mode 100644 new mode 100755 index 06d73e8..f3d2475 --- a/thirdparty/PEGTL/include/tao/pegtl/analysis/grammar_info.hpp +++ b/thirdparty/PEGTL/include/tao/pegtl/analysis/grammar_info.hpp @@ -1,4 +1,4 @@ -// Copyright (c) 2014-2018 Dr. Colin Hirsch and Daniel Frey +// Copyright (c) 2014-2019 Dr. Colin Hirsch and Daniel Frey // Please see LICENSE for license or visit https://github.com/taocpp/PEGTL/ #ifndef TAO_PEGTL_ANALYSIS_GRAMMAR_INFO_HPP diff --git a/thirdparty/PEGTL/include/tao/pegtl/analysis/insert_guard.hpp b/thirdparty/PEGTL/include/tao/pegtl/analysis/insert_guard.hpp old mode 100644 new mode 100755 index 6cd61c8..f4dad2a --- a/thirdparty/PEGTL/include/tao/pegtl/analysis/insert_guard.hpp +++ b/thirdparty/PEGTL/include/tao/pegtl/analysis/insert_guard.hpp @@ -1,4 +1,4 @@ -// Copyright (c) 2014-2018 Dr. Colin Hirsch and Daniel Frey +// Copyright (c) 2014-2019 Dr. Colin Hirsch and Daniel Frey // Please see LICENSE for license or visit https://github.com/taocpp/PEGTL/ #ifndef TAO_PEGTL_ANALYSIS_INSERT_GUARD_HPP diff --git a/thirdparty/PEGTL/include/tao/pegtl/analysis/insert_rules.hpp b/thirdparty/PEGTL/include/tao/pegtl/analysis/insert_rules.hpp old mode 100644 new mode 100755 index 6e172b3..73be089 --- a/thirdparty/PEGTL/include/tao/pegtl/analysis/insert_rules.hpp +++ b/thirdparty/PEGTL/include/tao/pegtl/analysis/insert_rules.hpp @@ -1,4 +1,4 @@ -// Copyright (c) 2014-2018 Dr. Colin Hirsch and Daniel Frey +// Copyright (c) 2014-2019 Dr. Colin Hirsch and Daniel Frey // Please see LICENSE for license or visit https://github.com/taocpp/PEGTL/ #ifndef TAO_PEGTL_ANALYSIS_INSERT_RULES_HPP diff --git a/thirdparty/PEGTL/include/tao/pegtl/analysis/rule_info.hpp b/thirdparty/PEGTL/include/tao/pegtl/analysis/rule_info.hpp old mode 100644 new mode 100755 index 30af0ed..97bb76b --- a/thirdparty/PEGTL/include/tao/pegtl/analysis/rule_info.hpp +++ b/thirdparty/PEGTL/include/tao/pegtl/analysis/rule_info.hpp @@ -1,4 +1,4 @@ -// Copyright (c) 2014-2018 Dr. Colin Hirsch and Daniel Frey +// Copyright (c) 2014-2019 Dr. Colin Hirsch and Daniel Frey // Please see LICENSE for license or visit https://github.com/taocpp/PEGTL/ #ifndef TAO_PEGTL_ANALYSIS_RULE_INFO_HPP diff --git a/thirdparty/PEGTL/include/tao/pegtl/analysis/rule_type.hpp b/thirdparty/PEGTL/include/tao/pegtl/analysis/rule_type.hpp old mode 100644 new mode 100755 index ebd7f4e..274c579 --- a/thirdparty/PEGTL/include/tao/pegtl/analysis/rule_type.hpp +++ b/thirdparty/PEGTL/include/tao/pegtl/analysis/rule_type.hpp @@ -1,4 +1,4 @@ -// Copyright (c) 2014-2018 Dr. Colin Hirsch and Daniel Frey +// Copyright (c) 2014-2019 Dr. Colin Hirsch and Daniel Frey // Please see LICENSE for license or visit https://github.com/taocpp/PEGTL/ #ifndef TAO_PEGTL_ANALYSIS_RULE_TYPE_HPP @@ -14,10 +14,16 @@ namespace tao { enum class rule_type : char { - ANY, // Consumption-on-success is always true; assumes bounded repetition of conjunction of sub-rules. - OPT, // Consumption-on-success not necessarily true; assumes bounded repetition of conjunction of sub-rules. - SEQ, // Consumption-on-success depends on consumption of (non-zero bounded repetition of) conjunction of sub-rules. - SOR // Consumption-on-success depends on consumption of (non-zero bounded repetition of) disjunction of sub-rules. + any, // Consumption-on-success is always true; assumes bounded repetition of conjunction of sub-rules. + opt, // Consumption-on-success not necessarily true; assumes bounded repetition of conjunction of sub-rules. + seq, // Consumption-on-success depends on consumption of (non-zero bounded repetition of) conjunction of sub-rules. + sor, // Consumption-on-success depends on consumption of (non-zero bounded repetition of) disjunction of sub-rules. + + // Compatibility, remove with 3.0.0 + ANY = any, + OPT = opt, + SEQ = seq, + SOR = sor }; } // namespace analysis diff --git a/thirdparty/PEGTL/include/tao/pegtl/analyze.hpp b/thirdparty/PEGTL/include/tao/pegtl/analyze.hpp old mode 100644 new mode 100755 index 08e0d7b..4a165f7 --- a/thirdparty/PEGTL/include/tao/pegtl/analyze.hpp +++ b/thirdparty/PEGTL/include/tao/pegtl/analyze.hpp @@ -1,4 +1,4 @@ -// Copyright (c) 2014-2018 Dr. Colin Hirsch and Daniel Frey +// Copyright (c) 2014-2019 Dr. Colin Hirsch and Daniel Frey // Please see LICENSE for license or visit https://github.com/taocpp/PEGTL/ #ifndef TAO_PEGTL_ANALYZE_HPP diff --git a/thirdparty/PEGTL/include/tao/pegtl/apply_mode.hpp b/thirdparty/PEGTL/include/tao/pegtl/apply_mode.hpp old mode 100644 new mode 100755 index c403c1b..9b81e9e --- a/thirdparty/PEGTL/include/tao/pegtl/apply_mode.hpp +++ b/thirdparty/PEGTL/include/tao/pegtl/apply_mode.hpp @@ -1,4 +1,4 @@ -// Copyright (c) 2014-2018 Dr. Colin Hirsch and Daniel Frey +// Copyright (c) 2014-2019 Dr. Colin Hirsch and Daniel Frey // Please see LICENSE for license or visit https://github.com/taocpp/PEGTL/ #ifndef TAO_PEGTL_APPLY_MODE_HPP @@ -12,8 +12,12 @@ namespace tao { enum class apply_mode : bool { - ACTION = true, - NOTHING = false + action = true, + nothing = false, + + // Compatibility, remove with 3.0.0 + ACTION = action, + NOTHING = nothing }; } // namespace TAO_PEGTL_NAMESPACE diff --git a/thirdparty/PEGTL/include/tao/pegtl/argv_input.hpp b/thirdparty/PEGTL/include/tao/pegtl/argv_input.hpp old mode 100644 new mode 100755 index de2343c..e0b119f --- a/thirdparty/PEGTL/include/tao/pegtl/argv_input.hpp +++ b/thirdparty/PEGTL/include/tao/pegtl/argv_input.hpp @@ -1,4 +1,4 @@ -// Copyright (c) 2017-2018 Dr. Colin Hirsch and Daniel Frey +// Copyright (c) 2017-2019 Dr. Colin Hirsch and Daniel Frey // Please see LICENSE for license or visit https://github.com/taocpp/PEGTL/ #ifndef TAO_PEGTL_ARGV_INPUT_HPP @@ -29,7 +29,7 @@ namespace tao } // namespace internal - template< tracking_mode P = tracking_mode::IMMEDIATE, typename Eol = eol::lf_crlf > + template< tracking_mode P = tracking_mode::eager, typename Eol = eol::lf_crlf > struct argv_input : public memory_input< P, Eol > { diff --git a/thirdparty/PEGTL/include/tao/pegtl/ascii.hpp b/thirdparty/PEGTL/include/tao/pegtl/ascii.hpp old mode 100644 new mode 100755 index b440b4d..e180950 --- a/thirdparty/PEGTL/include/tao/pegtl/ascii.hpp +++ b/thirdparty/PEGTL/include/tao/pegtl/ascii.hpp @@ -1,4 +1,4 @@ -// Copyright (c) 2014-2018 Dr. Colin Hirsch and Daniel Frey +// Copyright (c) 2014-2019 Dr. Colin Hirsch and Daniel Frey // Please see LICENSE for license or visit https://github.com/taocpp/PEGTL/ #ifndef TAO_PEGTL_ASCII_HPP @@ -7,6 +7,7 @@ #include "config.hpp" #include "eol.hpp" +#include "internal/always_false.hpp" #include "internal/result_on_found.hpp" #include "internal/rules.hpp" @@ -20,30 +21,31 @@ namespace tao struct alnum : internal::alnum {}; struct alpha : internal::alpha {}; struct any : internal::any< internal::peek_char > {}; - struct blank : internal::one< internal::result_on_found::SUCCESS, internal::peek_char, ' ', '\t' > {}; - struct digit : internal::range< internal::result_on_found::SUCCESS, internal::peek_char, '0', '9' > {}; + struct blank : internal::one< internal::result_on_found::success, internal::peek_char, ' ', '\t' > {}; + struct digit : internal::range< internal::result_on_found::success, internal::peek_char, '0', '9' > {}; + struct ellipsis : internal::string< '.', '.', '.' > {}; struct eolf : internal::eolf {}; - template< char... Cs > struct forty_two : internal::rep< 42, internal::one< internal::result_on_found::SUCCESS, internal::peek_char, Cs... > > {}; + template< char... Cs > struct forty_two : internal::rep< 42, internal::one< internal::result_on_found::success, internal::peek_char, Cs... > > {}; struct identifier_first : internal::identifier_first {}; struct identifier_other : internal::identifier_other {}; struct identifier : internal::identifier {}; template< char... Cs > struct istring : internal::istring< Cs... > {}; template< char... Cs > struct keyword : internal::seq< internal::string< Cs... >, internal::not_at< internal::identifier_other > > {}; - struct lower : internal::range< internal::result_on_found::SUCCESS, internal::peek_char, 'a', 'z' > {}; - template< char... Cs > struct not_one : internal::one< internal::result_on_found::FAILURE, internal::peek_char, Cs... > {}; - template< char Lo, char Hi > struct not_range : internal::range< internal::result_on_found::FAILURE, internal::peek_char, Lo, Hi > {}; - struct nul : internal::one< internal::result_on_found::SUCCESS, internal::peek_char, char( 0 ) > {}; - template< char... Cs > struct one : internal::one< internal::result_on_found::SUCCESS, internal::peek_char, Cs... > {}; - struct print : internal::range< internal::result_on_found::SUCCESS, internal::peek_char, char( 32 ), char( 126 ) > {}; - template< char Lo, char Hi > struct range : internal::range< internal::result_on_found::SUCCESS, internal::peek_char, Lo, Hi > {}; + struct lower : internal::range< internal::result_on_found::success, internal::peek_char, 'a', 'z' > {}; + template< char... Cs > struct not_one : internal::one< internal::result_on_found::failure, internal::peek_char, Cs... > {}; + template< char Lo, char Hi > struct not_range : internal::range< internal::result_on_found::failure, internal::peek_char, Lo, Hi > {}; + struct nul : internal::one< internal::result_on_found::success, internal::peek_char, char( 0 ) > {}; + template< char... Cs > struct one : internal::one< internal::result_on_found::success, internal::peek_char, Cs... > {}; + struct print : internal::range< internal::result_on_found::success, internal::peek_char, char( 32 ), char( 126 ) > {}; + template< char Lo, char Hi > struct range : internal::range< internal::result_on_found::success, internal::peek_char, Lo, Hi > {}; template< char... Cs > struct ranges : internal::ranges< internal::peek_char, Cs... > {}; - struct seven : internal::range< internal::result_on_found::SUCCESS, internal::peek_char, char( 0 ), char( 127 ) > {}; + struct seven : internal::range< internal::result_on_found::success, internal::peek_char, char( 0 ), char( 127 ) > {}; struct shebang : internal::if_must< false, internal::string< '#', '!' >, internal::until< internal::eolf > > {}; - struct space : internal::one< internal::result_on_found::SUCCESS, internal::peek_char, ' ', '\n', '\r', '\t', '\v', '\f' > {}; + struct space : internal::one< internal::result_on_found::success, internal::peek_char, ' ', '\n', '\r', '\t', '\v', '\f' > {}; template< char... Cs > struct string : internal::string< Cs... > {}; - template< char C > struct three : internal::three< C > {}; - template< char C > struct two : internal::two< C > {}; - struct upper : internal::range< internal::result_on_found::SUCCESS, internal::peek_char, 'A', 'Z' > {}; + template< char C > struct three : internal::string< C, C, C > {}; + template< char C > struct two : internal::string< C, C > {}; + struct upper : internal::range< internal::result_on_found::success, internal::peek_char, 'A', 'Z' > {}; struct xdigit : internal::ranges< internal::peek_char, '0', '9', 'a', 'f', 'A', 'F' > {}; // clang-format on @@ -53,7 +55,7 @@ namespace tao template< typename Input > static bool match( Input& /*unused*/ ) noexcept { - static_assert( sizeof( Input ) == 0, "empty keywords not allowed" ); + static_assert( internal::always_false< Input >::value, "empty keywords not allowed" ); return false; } }; diff --git a/thirdparty/PEGTL/include/tao/pegtl/buffer_input.hpp b/thirdparty/PEGTL/include/tao/pegtl/buffer_input.hpp old mode 100644 new mode 100755 index 4557aaf..34ee2d2 --- a/thirdparty/PEGTL/include/tao/pegtl/buffer_input.hpp +++ b/thirdparty/PEGTL/include/tao/pegtl/buffer_input.hpp @@ -1,13 +1,16 @@ -// Copyright (c) 2016-2018 Dr. Colin Hirsch and Daniel Frey +// Copyright (c) 2016-2019 Dr. Colin Hirsch and Daniel Frey // Please see LICENSE for license or visit https://github.com/taocpp/PEGTL/ #ifndef TAO_PEGTL_BUFFER_INPUT_HPP #define TAO_PEGTL_BUFFER_INPUT_HPP +#include +#include #include #include #include #include +#include #include #include "config.hpp" @@ -17,7 +20,7 @@ #include "tracking_mode.hpp" #include "internal/action_input.hpp" -#include "internal/bump_impl.hpp" +#include "internal/bump.hpp" #include "internal/iterator.hpp" #include "internal/marker.hpp" @@ -25,11 +28,10 @@ namespace tao { namespace TAO_PEGTL_NAMESPACE { - template< typename Reader, typename Eol = eol::lf_crlf, typename Source = std::string > + template< typename Reader, typename Eol = eol::lf_crlf, typename Source = std::string, std::size_t Chunk = 64 > class buffer_input { public: - static constexpr tracking_mode tracking_mode_v = tracking_mode::IMMEDIATE; using reader_t = Reader; using eol_t = Eol; @@ -39,15 +41,20 @@ namespace tao using action_t = internal::action_input< buffer_input >; + static constexpr std::size_t chunk_size = Chunk; + static constexpr tracking_mode tracking_mode_v = tracking_mode::eager; + template< typename T, typename... As > buffer_input( T&& in_source, const std::size_t maximum, As&&... as ) : m_reader( std::forward< As >( as )... ), - m_maximum( maximum ), - m_buffer( new char[ maximum ] ), + m_maximum( maximum + Chunk ), + m_buffer( new char[ maximum + Chunk ] ), m_current( m_buffer.get() ), m_end( m_buffer.get() ), m_source( std::forward< T >( in_source ) ) { + static_assert( Chunk != 0, "zero chunk size not implemented" ); + assert( m_maximum > maximum ); // Catches overflow; change to >= when zero chunk size is implemented. } buffer_input( const buffer_input& ) = delete; @@ -67,7 +74,7 @@ namespace tao std::size_t size( const std::size_t amount ) { require( amount ); - return std::size_t( m_end - m_current.data ); + return buffer_occupied(); } const char* current() const noexcept @@ -106,6 +113,12 @@ namespace tao return m_current.data[ offset ]; } + std::uint8_t peek_uint8( const std::size_t offset = 0 ) const noexcept + { + return static_cast< std::uint8_t >( peek_char( offset ) ); + } + + // Compatibility, remove with 3.0.0 std::uint8_t peek_byte( const std::size_t offset = 0 ) const noexcept { return static_cast< std::uint8_t >( peek_char( offset ) ); @@ -128,23 +141,24 @@ namespace tao void discard() noexcept { - const auto s = m_end - m_current.data; - std::memmove( m_buffer.get(), m_current.data, s ); - m_current.data = m_buffer.get(); - m_end = m_buffer.get() + s; + if( m_current.data > m_buffer.get() + Chunk ) { + const auto s = m_end - m_current.data; + std::memmove( m_buffer.get(), m_current.data, s ); + m_current.data = m_buffer.get(); + m_end = m_buffer.get() + s; + } } void require( const std::size_t amount ) { - if( m_current.data + amount > m_end ) { - if( m_current.data + amount <= m_buffer.get() + m_maximum ) { - if( const auto r = m_reader( m_end, amount - std::size_t( m_end - m_current.data ) ) ) { - m_end += r; - } - else { - m_maximum = 0; - } - } + if( m_current.data + amount <= m_end ) { + return; + } + if( m_current.data + amount > m_buffer.get() + m_maximum ) { + throw std::overflow_error( "require beyond end of buffer" ); + } + if( const auto r = m_reader( m_end, ( std::min )( buffer_free_after_end(), ( std::max )( amount, Chunk ) ) ) ) { + m_end += r; } } @@ -169,10 +183,33 @@ namespace tao return m_current; } + std::size_t buffer_capacity() const noexcept + { + return m_maximum; + } + + std::size_t buffer_occupied() const noexcept + { + assert( m_end >= m_current.data ); + return std::size_t( m_end - m_current.data ); + } + + std::size_t buffer_free_before_current() const noexcept + { + assert( m_current.data >= m_buffer.get() ); + return std::size_t( m_current.data - m_buffer.get() ); + } + + std::size_t buffer_free_after_end() const noexcept + { + assert( m_buffer.get() + m_maximum >= m_end ); + return std::size_t( m_buffer.get() + m_maximum - m_end ); + } + private: Reader m_reader; std::size_t m_maximum; - std::unique_ptr< char[] > m_buffer; + std::unique_ptr< char[] > m_buffer; // NOLINT iterator_t m_current; char* m_end; const Source m_source; diff --git a/thirdparty/PEGTL/include/tao/pegtl/change_action.hpp b/thirdparty/PEGTL/include/tao/pegtl/change_action.hpp new file mode 100755 index 0000000..f1b9660 --- /dev/null +++ b/thirdparty/PEGTL/include/tao/pegtl/change_action.hpp @@ -0,0 +1,42 @@ +// Copyright (c) 2019 Dr. Colin Hirsch and Daniel Frey +// Please see LICENSE for license or visit https://github.com/taocpp/PEGTL/ + +#ifndef TAO_PEGTL_CHANGE_ACTION_HPP +#define TAO_PEGTL_CHANGE_ACTION_HPP + +#include + +#include "apply_mode.hpp" +#include "config.hpp" +#include "nothing.hpp" +#include "rewind_mode.hpp" + +namespace tao +{ + namespace TAO_PEGTL_NAMESPACE + { + template< template< typename... > class NewAction > + struct change_action + : maybe_nothing + { + template< typename Rule, + apply_mode A, + rewind_mode M, + template< typename... > + class Action, + template< typename... > + class Control, + typename Input, + typename... States > + static bool match( Input& in, States&&... st ) + { + static_assert( !std::is_same< Action< void >, NewAction< void > >::value, "old and new action class templates are identical" ); + return Control< Rule >::template match< A, M, NewAction, Control >( in, st... ); + } + }; + + } // namespace TAO_PEGTL_NAMESPACE + +} // namespace tao + +#endif diff --git a/thirdparty/PEGTL/include/tao/pegtl/change_action_and_state.hpp b/thirdparty/PEGTL/include/tao/pegtl/change_action_and_state.hpp new file mode 100755 index 0000000..0c3fdc4 --- /dev/null +++ b/thirdparty/PEGTL/include/tao/pegtl/change_action_and_state.hpp @@ -0,0 +1,73 @@ +// Copyright (c) 2019 Dr. Colin Hirsch and Daniel Frey +// Please see LICENSE for license or visit https://github.com/taocpp/PEGTL/ + +#ifndef TAO_PEGTL_CHANGE_ACTION_AND_STATE_HPP +#define TAO_PEGTL_CHANGE_ACTION_AND_STATE_HPP + +#include + +#include "apply_mode.hpp" +#include "config.hpp" +#include "nothing.hpp" +#include "rewind_mode.hpp" + +namespace tao +{ + namespace TAO_PEGTL_NAMESPACE + { + template< template< typename... > class NewAction, typename NewState > + struct change_action_and_state + : maybe_nothing + { + template< typename Rule, + apply_mode A, + rewind_mode M, + template< typename... > + class Action, + template< typename... > + class Control, + typename Input, + typename... States > + static auto match( Input& in, States&&... st ) + -> typename std::enable_if< ( A == apply_mode::action ), bool >::type + { + static_assert( !std::is_same< Action< void >, NewAction< void > >::value, "old and new action class templates are identical" ); + NewState s( static_cast< const Input& >( in ), st... ); + if( Control< Rule >::template match< A, M, NewAction, Control >( in, s ) ) { + Action< Rule >::success( static_cast< const Input& >( in ), s, st... ); + return true; + } + return false; + } + + template< typename Rule, + apply_mode A, + rewind_mode M, + template< typename... > + class Action, + template< typename... > + class Control, + typename Input, + typename... States, + int = 1 > + static auto match( Input& in, States&&... st ) + -> typename std::enable_if< ( A == apply_mode::nothing ), bool >::type + { + static_assert( !std::is_same< Action< void >, NewAction< void > >::value, "old and new action class templates are identical" ); + NewState s( static_cast< const Input& >( in ), st... ); + return Control< Rule >::template match< A, M, NewAction, Control >( in, s ); + } + + template< typename Input, + typename... States > + static void success( const Input& in, NewState& s, States&&... st ) noexcept( noexcept( s.success( in, st... ) ) ) + { + s.success( in, st... ); + } + }; + + } // namespace TAO_PEGTL_NAMESPACE + +} // namespace tao + +#endif diff --git a/thirdparty/PEGTL/include/tao/pegtl/change_action_and_states.hpp b/thirdparty/PEGTL/include/tao/pegtl/change_action_and_states.hpp new file mode 100755 index 0000000..c66eb88 --- /dev/null +++ b/thirdparty/PEGTL/include/tao/pegtl/change_action_and_states.hpp @@ -0,0 +1,83 @@ +// Copyright (c) 2019 Dr. Colin Hirsch and Daniel Frey +// Please see LICENSE for license or visit https://github.com/taocpp/PEGTL/ + +#ifndef TAO_PEGTL_CHANGE_ACTION_AND_STATES_HPP +#define TAO_PEGTL_CHANGE_ACTION_AND_STATES_HPP + +#include +#include + +#include "apply_mode.hpp" +#include "config.hpp" +#include "nothing.hpp" +#include "rewind_mode.hpp" + +#include "internal/integer_sequence.hpp" + +namespace tao +{ + namespace TAO_PEGTL_NAMESPACE + { + template< template< typename... > class NewAction, typename... NewStates > + struct change_action_and_states + : maybe_nothing + { + template< typename Rule, + apply_mode A, + rewind_mode M, + template< typename... > + class Action, + template< typename... > + class Control, + std::size_t... Ns, + typename Input, + typename... States > + static bool match( TAO_PEGTL_NAMESPACE::internal::index_sequence< Ns... >, Input& in, States&&... st ) + { + auto t = std::tie( st... ); + if( Control< Rule >::template match< A, M, NewAction, Control >( in, std::get< Ns >( t )... ) ) { + Action< Rule >::success( static_cast< const Input& >( in ), st... ); + return true; + } + return false; + } + + template< typename Rule, + apply_mode A, + rewind_mode M, + template< typename... > + class Action, + template< typename... > + class Control, + typename Input, + typename... States > + static auto match( Input& in, States&&... st ) + -> typename std::enable_if< ( A == apply_mode::action ), bool >::type + { + static_assert( !std::is_same< Action< void >, NewAction< void > >::value, "old and new action class templates are identical" ); + return match< Rule, A, M, Action, Control >( TAO_PEGTL_NAMESPACE::internal::index_sequence_for< NewStates... >(), in, NewStates()..., st... ); + } + + template< typename Rule, + apply_mode A, + rewind_mode M, + template< typename... > + class Action, + template< typename... > + class Control, + typename Input, + typename... States, + int = 1 > + static auto match( Input& in, States&&... /*unused*/ ) + -> typename std::enable_if< ( A == apply_mode::nothing ), bool >::type + { + static_assert( !std::is_same< Action< void >, NewAction< void > >::value, "old and new action class templates are identical" ); + return Control< Rule >::template match< A, M, NewAction, Control >( in, NewStates()... ); + } + }; + + } // namespace TAO_PEGTL_NAMESPACE + +} // namespace tao + +#endif diff --git a/thirdparty/PEGTL/include/tao/pegtl/change_control.hpp b/thirdparty/PEGTL/include/tao/pegtl/change_control.hpp new file mode 100755 index 0000000..8830ae5 --- /dev/null +++ b/thirdparty/PEGTL/include/tao/pegtl/change_control.hpp @@ -0,0 +1,40 @@ +// Copyright (c) 2019 Dr. Colin Hirsch and Daniel Frey +// Please see LICENSE for license or visit https://github.com/taocpp/PEGTL/ + +#ifndef TAO_PEGTL_CHANGE_CONTROL_HPP +#define TAO_PEGTL_CHANGE_CONTROL_HPP + +#include "apply_mode.hpp" +#include "config.hpp" +#include "match.hpp" +#include "nothing.hpp" +#include "rewind_mode.hpp" + +namespace tao +{ + namespace TAO_PEGTL_NAMESPACE + { + template< template< typename... > class NewControl > + struct change_control + : maybe_nothing + { + template< typename Rule, + apply_mode A, + rewind_mode M, + template< typename... > + class Action, + template< typename... > + class Control, + typename Input, + typename... States > + static bool match( Input& in, States&&... st ) + { + return TAO_PEGTL_NAMESPACE::match< Rule, A, M, Action, NewControl >( in, st... ); + } + }; + + } // namespace TAO_PEGTL_NAMESPACE + +} // namespace tao + +#endif diff --git a/thirdparty/PEGTL/include/tao/pegtl/change_state.hpp b/thirdparty/PEGTL/include/tao/pegtl/change_state.hpp new file mode 100755 index 0000000..923c3ce --- /dev/null +++ b/thirdparty/PEGTL/include/tao/pegtl/change_state.hpp @@ -0,0 +1,72 @@ +// Copyright (c) 2019 Dr. Colin Hirsch and Daniel Frey +// Please see LICENSE for license or visit https://github.com/taocpp/PEGTL/ + +#ifndef TAO_PEGTL_CHANGE_STATE_HPP +#define TAO_PEGTL_CHANGE_STATE_HPP + +#include + +#include "apply_mode.hpp" +#include "config.hpp" +#include "match.hpp" +#include "nothing.hpp" +#include "rewind_mode.hpp" + +namespace tao +{ + namespace TAO_PEGTL_NAMESPACE + { + template< typename NewState > + struct change_state + : maybe_nothing + { + template< typename Rule, + apply_mode A, + rewind_mode M, + template< typename... > + class Action, + template< typename... > + class Control, + typename Input, + typename... States > + static auto match( Input& in, States&&... st ) + -> typename std::enable_if< ( A == apply_mode::action ), bool >::type + { + NewState s( static_cast< const Input& >( in ), st... ); + if( TAO_PEGTL_NAMESPACE::match< Rule, A, M, Action, Control >( in, s ) ) { + Action< Rule >::success( static_cast< const Input& >( in ), s, st... ); + return true; + } + return false; + } + + template< typename Rule, + apply_mode A, + rewind_mode M, + template< typename... > + class Action, + template< typename... > + class Control, + typename Input, + typename... States, + int = 1 > + static auto match( Input& in, States&&... st ) + -> typename std::enable_if< ( A == apply_mode::nothing ), bool >::type + { + NewState s( static_cast< const Input& >( in ), st... ); + return TAO_PEGTL_NAMESPACE::match< Rule, A, M, Action, Control >( in, s ); + } + + template< typename Input, + typename... States > + static void success( const Input& in, NewState& s, States&&... st ) noexcept( noexcept( s.success( in, st... ) ) ) + { + s.success( in, st... ); + } + }; + + } // namespace TAO_PEGTL_NAMESPACE + +} // namespace tao + +#endif diff --git a/thirdparty/PEGTL/include/tao/pegtl/change_states.hpp b/thirdparty/PEGTL/include/tao/pegtl/change_states.hpp new file mode 100755 index 0000000..2a9a0fb --- /dev/null +++ b/thirdparty/PEGTL/include/tao/pegtl/change_states.hpp @@ -0,0 +1,81 @@ +// Copyright (c) 2019 Dr. Colin Hirsch and Daniel Frey +// Please see LICENSE for license or visit https://github.com/taocpp/PEGTL/ + +#ifndef TAO_PEGTL_CHANGE_STATES_HPP +#define TAO_PEGTL_CHANGE_STATES_HPP + +#include + +#include "apply_mode.hpp" +#include "config.hpp" +#include "match.hpp" +#include "nothing.hpp" +#include "rewind_mode.hpp" + +#include "internal/integer_sequence.hpp" + +namespace tao +{ + namespace TAO_PEGTL_NAMESPACE + { + template< typename... NewStates > + struct change_states + : maybe_nothing + { + template< typename Rule, + apply_mode A, + rewind_mode M, + template< typename... > + class Action, + template< typename... > + class Control, + std::size_t... Ns, + typename Input, + typename... States > + static bool match( TAO_PEGTL_NAMESPACE::internal::index_sequence< Ns... >, Input& in, States&&... st ) + { + auto t = std::tie( st... ); + if( TAO_PEGTL_NAMESPACE::match< Rule, A, M, Action, Control >( in, std::get< Ns >( t )... ) ) { + Action< Rule >::success( static_cast< const Input& >( in ), st... ); + return true; + } + return false; + } + + template< typename Rule, + apply_mode A, + rewind_mode M, + template< typename... > + class Action, + template< typename... > + class Control, + typename Input, + typename... States > + static auto match( Input& in, States&&... st ) + -> typename std::enable_if< ( A == apply_mode::action ), bool >::type + { + return match< Rule, A, M, Action, Control >( TAO_PEGTL_NAMESPACE::internal::index_sequence_for< NewStates... >(), in, NewStates()..., st... ); + } + + template< typename Rule, + apply_mode A, + rewind_mode M, + template< typename... > + class Action, + template< typename... > + class Control, + typename Input, + typename... States, + int = 1 > + static auto match( Input& in, States&&... /*unused*/ ) + -> typename std::enable_if< ( A == apply_mode::nothing ), bool >::type + { + return TAO_PEGTL_NAMESPACE::match< Rule, A, M, Action, Control >( in, NewStates()... ); + } + }; + + } // namespace TAO_PEGTL_NAMESPACE + +} // namespace tao + +#endif diff --git a/thirdparty/PEGTL/include/tao/pegtl/config.hpp b/thirdparty/PEGTL/include/tao/pegtl/config.hpp old mode 100644 new mode 100755 index ed8cbd1..292ffcc --- a/thirdparty/PEGTL/include/tao/pegtl/config.hpp +++ b/thirdparty/PEGTL/include/tao/pegtl/config.hpp @@ -1,10 +1,10 @@ -// Copyright (c) 2017-2018 Dr. Colin Hirsch and Daniel Frey +// Copyright (c) 2017-2019 Dr. Colin Hirsch and Daniel Frey // Please see LICENSE for license or visit https://github.com/taocpp/PEGTL/ #ifndef TAO_PEGTL_CONFIG_HPP #define TAO_PEGTL_CONFIG_HPP -// Compatibility, remove with 3.0 +// Compatibility, remove with 3.0.0 #ifdef TAOCPP_PEGTL_NAMESPACE #define TAO_PEGTL_NAMESPACE TAOCPP_PEGTL_NAMESPACE #endif diff --git a/thirdparty/PEGTL/include/tao/pegtl/contrib/abnf.hpp b/thirdparty/PEGTL/include/tao/pegtl/contrib/abnf.hpp old mode 100644 new mode 100755 index e006f06..3b45ac8 --- a/thirdparty/PEGTL/include/tao/pegtl/contrib/abnf.hpp +++ b/thirdparty/PEGTL/include/tao/pegtl/contrib/abnf.hpp @@ -1,4 +1,4 @@ -// Copyright (c) 2014-2018 Dr. Colin Hirsch and Daniel Frey +// Copyright (c) 2014-2019 Dr. Colin Hirsch and Daniel Frey // Please see LICENSE for license or visit https://github.com/taocpp/PEGTL/ #ifndef TAO_PEGTL_CONTRIB_ABNF_HPP @@ -17,21 +17,21 @@ namespace tao // clang-format off struct ALPHA : internal::ranges< internal::peek_char, 'a', 'z', 'A', 'Z' > {}; - struct BIT : internal::one< internal::result_on_found::SUCCESS, internal::peek_char, '0', '1' > {}; - struct CHAR : internal::range< internal::result_on_found::SUCCESS, internal::peek_char, char( 1 ), char( 127 ) > {}; - struct CR : internal::one< internal::result_on_found::SUCCESS, internal::peek_char, '\r' > {}; + struct BIT : internal::one< internal::result_on_found::success, internal::peek_char, '0', '1' > {}; + struct CHAR : internal::range< internal::result_on_found::success, internal::peek_char, char( 1 ), char( 127 ) > {}; + struct CR : internal::one< internal::result_on_found::success, internal::peek_char, '\r' > {}; struct CRLF : internal::string< '\r', '\n' > {}; struct CTL : internal::ranges< internal::peek_char, char( 0 ), char( 31 ), char( 127 ) > {}; - struct DIGIT : internal::range< internal::result_on_found::SUCCESS, internal::peek_char, '0', '9' > {}; - struct DQUOTE : internal::one< internal::result_on_found::SUCCESS, internal::peek_char, '"' > {}; + struct DIGIT : internal::range< internal::result_on_found::success, internal::peek_char, '0', '9' > {}; + struct DQUOTE : internal::one< internal::result_on_found::success, internal::peek_char, '"' > {}; struct HEXDIG : internal::ranges< internal::peek_char, '0', '9', 'a', 'f', 'A', 'F' > {}; - struct HTAB : internal::one< internal::result_on_found::SUCCESS, internal::peek_char, '\t' > {}; - struct LF : internal::one< internal::result_on_found::SUCCESS, internal::peek_char, '\n' > {}; - struct LWSP : internal::star< internal::sor< internal::string< '\r', '\n' >, internal::one< internal::result_on_found::SUCCESS, internal::peek_char, ' ', '\t' > >, internal::one< internal::result_on_found::SUCCESS, internal::peek_char, ' ', '\t' > > {}; + struct HTAB : internal::one< internal::result_on_found::success, internal::peek_char, '\t' > {}; + struct LF : internal::one< internal::result_on_found::success, internal::peek_char, '\n' > {}; + struct LWSP : internal::star< internal::sor< internal::string< '\r', '\n' >, internal::one< internal::result_on_found::success, internal::peek_char, ' ', '\t' > >, internal::one< internal::result_on_found::success, internal::peek_char, ' ', '\t' > > {}; struct OCTET : internal::any< internal::peek_char > {}; - struct SP : internal::one< internal::result_on_found::SUCCESS, internal::peek_char, ' ' > {}; - struct VCHAR : internal::range< internal::result_on_found::SUCCESS, internal::peek_char, char( 33 ), char( 126 ) > {}; - struct WSP : internal::one< internal::result_on_found::SUCCESS, internal::peek_char, ' ', '\t' > {}; + struct SP : internal::one< internal::result_on_found::success, internal::peek_char, ' ' > {}; + struct VCHAR : internal::range< internal::result_on_found::success, internal::peek_char, char( 33 ), char( 126 ) > {}; + struct WSP : internal::one< internal::result_on_found::success, internal::peek_char, ' ', '\t' > {}; // clang-format on } // namespace abnf diff --git a/thirdparty/PEGTL/include/tao/pegtl/contrib/alphabet.hpp b/thirdparty/PEGTL/include/tao/pegtl/contrib/alphabet.hpp old mode 100644 new mode 100755 index 2e0228b..6a5ddc8 --- a/thirdparty/PEGTL/include/tao/pegtl/contrib/alphabet.hpp +++ b/thirdparty/PEGTL/include/tao/pegtl/contrib/alphabet.hpp @@ -1,4 +1,4 @@ -// Copyright (c) 2015-2018 Dr. Colin Hirsch and Daniel Frey +// Copyright (c) 2015-2019 Dr. Colin Hirsch and Daniel Frey // Please see LICENSE for license or visit https://github.com/taocpp/PEGTL/ #ifndef TAO_PEGTL_CONTRIB_ALPHABET_HPP diff --git a/thirdparty/PEGTL/include/tao/pegtl/contrib/changes.hpp b/thirdparty/PEGTL/include/tao/pegtl/contrib/changes.hpp old mode 100644 new mode 100755 index 0aa8ab0..c59d803 --- a/thirdparty/PEGTL/include/tao/pegtl/contrib/changes.hpp +++ b/thirdparty/PEGTL/include/tao/pegtl/contrib/changes.hpp @@ -1,14 +1,14 @@ -// Copyright (c) 2015-2018 Dr. Colin Hirsch and Daniel Frey +// Copyright (c) 2015-2019 Dr. Colin Hirsch and Daniel Frey // Please see LICENSE for license or visit https://github.com/taocpp/PEGTL/ #ifndef TAO_PEGTL_CONTRIB_CHANGES_HPP #define TAO_PEGTL_CONTRIB_CHANGES_HPP +#include + #include "../config.hpp" #include "../normal.hpp" -#include "../internal/conditional.hpp" - namespace tao { namespace TAO_PEGTL_NAMESPACE @@ -23,24 +23,26 @@ namespace tao } }; - template< apply_mode A, typename State > - using state_disable_helper = typename conditional< A == apply_mode::ACTION >::template type< State, dummy_disabled_state >; + template< apply_mode A, typename NewState > + using state_disable_helper = typename std::conditional< A == apply_mode::action, NewState, dummy_disabled_state >::type; } // namespace internal - template< typename Rule, typename State, template< typename... > class Base = normal > + template< typename Rule, typename NewState, template< typename... > class Base = normal > struct change_state : public Base< Rule > { template< apply_mode A, rewind_mode M, - template< typename... > class Action, - template< typename... > class Control, + template< typename... > + class Action, + template< typename... > + class Control, typename Input, typename... States > static bool match( Input& in, States&&... st ) { - internal::state_disable_helper< A, State > s; + internal::state_disable_helper< A, NewState > s; if( Base< Rule >::template match< A, M, Action, Control >( in, s ) ) { s.success( st... ); @@ -50,32 +52,34 @@ namespace tao } }; - template< typename Rule, template< typename... > class Action, template< typename... > class Base = normal > + template< typename Rule, template< typename... > class NewAction, template< typename... > class Base = normal > struct change_action : public Base< Rule > { template< apply_mode A, rewind_mode M, - template< typename... > class, - template< typename... > class Control, + template< typename... > + class Action, + template< typename... > + class Control, typename Input, typename... States > static bool match( Input& in, States&&... st ) { - return Base< Rule >::template match< A, M, Action, Control >( in, st... ); + return Base< Rule >::template match< A, M, NewAction, Control >( in, st... ); } }; - template< template< typename... > class Action, template< typename... > class Base > + template< template< typename... > class NewAction, template< typename... > class Base > struct change_both_helper { template< typename T > - using change_action = change_action< T, Action, Base >; + using change_action = change_action< T, NewAction, Base >; }; - template< typename Rule, typename State, template< typename... > class Action, template< typename... > class Base = normal > + template< typename Rule, typename NewState, template< typename... > class NewAction, template< typename... > class Base = normal > struct change_state_and_action - : public change_state< Rule, State, change_both_helper< Action, Base >::template change_action > + : public change_state< Rule, NewState, change_both_helper< NewAction, Base >::template change_action > { }; diff --git a/thirdparty/PEGTL/include/tao/pegtl/contrib/counter.hpp b/thirdparty/PEGTL/include/tao/pegtl/contrib/counter.hpp old mode 100644 new mode 100755 index 111fd38..b52d30f --- a/thirdparty/PEGTL/include/tao/pegtl/contrib/counter.hpp +++ b/thirdparty/PEGTL/include/tao/pegtl/contrib/counter.hpp @@ -1,4 +1,4 @@ -// Copyright (c) 2014-2018 Dr. Colin Hirsch and Daniel Frey +// Copyright (c) 2014-2019 Dr. Colin Hirsch and Daniel Frey // Please see LICENSE for license or visit https://github.com/taocpp/PEGTL/ #ifndef TAO_PEGTL_CONTRIB_COUNTER_HPP diff --git a/thirdparty/PEGTL/include/tao/pegtl/contrib/http.hpp b/thirdparty/PEGTL/include/tao/pegtl/contrib/http.hpp old mode 100644 new mode 100755 index c49cb6f..73b3cd5 --- a/thirdparty/PEGTL/include/tao/pegtl/contrib/http.hpp +++ b/thirdparty/PEGTL/include/tao/pegtl/contrib/http.hpp @@ -1,4 +1,4 @@ -// Copyright (c) 2014-2018 Dr. Colin Hirsch and Daniel Frey +// Copyright (c) 2014-2019 Dr. Colin Hirsch and Daniel Frey // Please see LICENSE for license or visit https://github.com/taocpp/PEGTL/ #ifndef TAO_PEGTL_CONTRIB_HTTP_HPP @@ -6,10 +6,12 @@ #include "../ascii.hpp" #include "../config.hpp" +#include "../nothing.hpp" #include "../rules.hpp" #include "../utf8.hpp" #include "abnf.hpp" +#include "remove_first_state.hpp" #include "uri.hpp" namespace tao @@ -28,7 +30,6 @@ namespace tao using RWS = plus< abnf::WSP >; // required whitespace using BWS = OWS; // "bad" whitespace - // cppcheck-suppress constStatement using obs_text = not_range< 0x00, 0x7F >; using obs_fold = seq< abnf::CRLF, plus< abnf::WSP > >; @@ -125,17 +126,130 @@ namespace tao struct partial_URI : seq< uri::relative_part, uri::opt_query > {}; - struct chunk_size : plus< abnf::HEXDIG > {}; + // clang-format on + struct chunk_size + { + using analyze_t = plus< abnf::HEXDIG >::analyze_t; + + template< apply_mode A, + rewind_mode M, + template< typename... > + class Action, + template< typename... > + class Control, + typename Input, + typename... States > + static bool match( Input& in, std::size_t& size, States&&... /*unused*/ ) + { + size = 0; + std::size_t i = 0; + while( in.size( i + 1 ) >= i + 1 ) { + const auto c = in.peek_char( i ); + if( ( '0' <= c ) && ( c <= '9' ) ) { + size <<= 4; + size |= std::size_t( c - '0' ); + ++i; + continue; + } + if( ( 'a' <= c ) && ( c <= 'f' ) ) { + size <<= 4; + size |= std::size_t( c - 'a' + 10 ); + ++i; + continue; + } + if( ( 'A' <= c ) && ( c <= 'F' ) ) { + size <<= 4; + size |= std::size_t( c - 'A' + 10 ); + ++i; + continue; + } + break; + } + in.bump_in_this_line( i ); + return i > 0; + } + }; + // clang-format off struct chunk_ext_name : token {}; struct chunk_ext_val : sor< quoted_string, token > {}; struct chunk_ext : star_must< one< ';' >, chunk_ext_name, if_must< one< '=' >, chunk_ext_val > > {}; - struct chunk_data : until< at< abnf::CRLF >, abnf::OCTET > {}; - - struct chunk : seq< chunk_size, opt< chunk_ext >, abnf::CRLF, chunk_data, abnf::CRLF > {}; + // clang-format on + struct chunk_data + { + using analyze_t = star< abnf::OCTET >::analyze_t; + + template< apply_mode A, + rewind_mode M, + template< typename... > + class Action, + template< typename... > + class Control, + typename Input, + typename... States > + static bool match( Input& in, const std::size_t size, States&&... /*unused*/ ) + { + if( in.size( size ) >= size ) { + in.bump( size ); + return true; + } + return false; + } + }; + + namespace internal + { + namespace chunk_helper + { + template< typename Rule, template< typename... > class Control > + struct control + : remove_self_and_first_state< Rule, Control > + {}; + + template< template< typename... > class Control > + struct control< chunk_size, Control > + : remove_first_state_after_match< Control< chunk_size > > + {}; + + template< template< typename... > class Control > + struct control< chunk_data, Control > + : remove_first_state_after_match< Control< chunk_data > > + {}; + + template< template< typename... > class Control > + struct bind + { + template< typename Rule > + using type = control< Rule, Control >; + }; + + } // namespace chunk_helper + + } // namespace internal + + struct chunk + { + using impl = seq< chunk_size, chunk_ext, abnf::CRLF, chunk_data, abnf::CRLF >; + using analyze_t = impl::analyze_t; + + template< apply_mode A, + rewind_mode M, + template< typename... > + class Action, + template< typename... > + class Control, + typename Input, + typename... States > + static bool match( Input& in, States&&... st ) + { + std::size_t size{}; + return impl::template match< A, M, Action, internal::chunk_helper::bind< Control >::template type >( in, size, st... ); + } + }; - struct last_chunk : seq< plus< one< '0' > >, opt< chunk_ext >, abnf::CRLF > {}; + // clang-format off + struct last_chunk : seq< plus< one< '0' > >, not_at< digit >, chunk_ext, abnf::CRLF > {}; struct trailer_part : star< header_field, abnf::CRLF > {}; diff --git a/thirdparty/PEGTL/include/tao/pegtl/contrib/icu/internal.hpp b/thirdparty/PEGTL/include/tao/pegtl/contrib/icu/internal.hpp old mode 100644 new mode 100755 index e1af0bb..d811159 --- a/thirdparty/PEGTL/include/tao/pegtl/contrib/icu/internal.hpp +++ b/thirdparty/PEGTL/include/tao/pegtl/contrib/icu/internal.hpp @@ -1,4 +1,4 @@ -// Copyright (c) 2018 Dr. Colin Hirsch and Daniel Frey +// Copyright (c) 2018-2019 Dr. Colin Hirsch and Daniel Frey // Please see LICENSE for license or visit https://github.com/taocpp/PEGTL/ #ifndef TAO_PEGTL_CONTRIB_ICU_INTERNAL_HPP @@ -22,15 +22,18 @@ namespace tao template< typename Peek, UProperty P, bool V = true > struct binary_property { - using analyze_t = analysis::generic< analysis::rule_type::ANY >; + using analyze_t = analysis::generic< analysis::rule_type::any >; template< typename Input > - static bool match( Input& in ) noexcept( noexcept( Peek::peek( in ) ) ) + static bool match( Input& in ) noexcept( noexcept( in.size( Peek::max_input_size ) ) ) { - if( const auto r = Peek::peek( in ) ) { - if( u_hasBinaryProperty( r.data, P ) == V ) { - in.bump( r.size ); - return true; + const std::size_t s = in.size( Peek::max_input_size ); + if( s >= Peek::min_input_size ) { + if( const auto r = Peek::peek( in, s ) ) { + if( u_hasBinaryProperty( r.data, P ) == V ) { + in.bump( r.size ); + return true; + } } } return false; @@ -40,15 +43,18 @@ namespace tao template< typename Peek, UProperty P, int V > struct property_value { - using analyze_t = analysis::generic< analysis::rule_type::ANY >; + using analyze_t = analysis::generic< analysis::rule_type::any >; template< typename Input > - static bool match( Input& in ) noexcept( noexcept( Peek::peek( in ) ) ) + static bool match( Input& in ) noexcept( noexcept( in.size( Peek::max_input_size ) ) ) { - if( const auto r = Peek::peek( in ) ) { - if( u_getIntPropertyValue( r.data, P ) == V ) { - in.bump( r.size ); - return true; + const std::size_t s = in.size( Peek::max_input_size ); + if( s >= Peek::min_input_size ) { + if( const auto r = Peek::peek( in, s ) ) { + if( u_getIntPropertyValue( r.data, P ) == V ) { + in.bump( r.size ); + return true; + } } } return false; diff --git a/thirdparty/PEGTL/include/tao/pegtl/contrib/icu/utf16.hpp b/thirdparty/PEGTL/include/tao/pegtl/contrib/icu/utf16.hpp old mode 100644 new mode 100755 index 2412545..5179b5e --- a/thirdparty/PEGTL/include/tao/pegtl/contrib/icu/utf16.hpp +++ b/thirdparty/PEGTL/include/tao/pegtl/contrib/icu/utf16.hpp @@ -1,4 +1,4 @@ -// Copyright (c) 2018 Dr. Colin Hirsch and Daniel Frey +// Copyright (c) 2018-2019 Dr. Colin Hirsch and Daniel Frey // Please see LICENSE for license or visit https://github.com/taocpp/PEGTL/ #ifndef TAO_PEGTL_CONTRIB_ICU_UTF16_HPP diff --git a/thirdparty/PEGTL/include/tao/pegtl/contrib/icu/utf32.hpp b/thirdparty/PEGTL/include/tao/pegtl/contrib/icu/utf32.hpp old mode 100644 new mode 100755 index 95c1a34..7274cb6 --- a/thirdparty/PEGTL/include/tao/pegtl/contrib/icu/utf32.hpp +++ b/thirdparty/PEGTL/include/tao/pegtl/contrib/icu/utf32.hpp @@ -1,4 +1,4 @@ -// Copyright (c) 2018 Dr. Colin Hirsch and Daniel Frey +// Copyright (c) 2018-2019 Dr. Colin Hirsch and Daniel Frey // Please see LICENSE for license or visit https://github.com/taocpp/PEGTL/ #ifndef TAO_PEGTL_CONTRIB_ICU_UTF32_HPP diff --git a/thirdparty/PEGTL/include/tao/pegtl/contrib/icu/utf8.hpp b/thirdparty/PEGTL/include/tao/pegtl/contrib/icu/utf8.hpp old mode 100644 new mode 100755 index a2aba56..0795c76 --- a/thirdparty/PEGTL/include/tao/pegtl/contrib/icu/utf8.hpp +++ b/thirdparty/PEGTL/include/tao/pegtl/contrib/icu/utf8.hpp @@ -1,4 +1,4 @@ -// Copyright (c) 2018 Dr. Colin Hirsch and Daniel Frey +// Copyright (c) 2018-2019 Dr. Colin Hirsch and Daniel Frey // Please see LICENSE for license or visit https://github.com/taocpp/PEGTL/ #ifndef TAO_PEGTL_CONTRIB_ICU_UTF8_HPP diff --git a/thirdparty/PEGTL/include/tao/pegtl/contrib/if_then.hpp b/thirdparty/PEGTL/include/tao/pegtl/contrib/if_then.hpp old mode 100644 new mode 100755 index 496ada6..95df822 --- a/thirdparty/PEGTL/include/tao/pegtl/contrib/if_then.hpp +++ b/thirdparty/PEGTL/include/tao/pegtl/contrib/if_then.hpp @@ -1,4 +1,4 @@ -// Copyright (c) 2018 Dr. Colin Hirsch and Daniel Frey +// Copyright (c) 2018-2019 Dr. Colin Hirsch and Daniel Frey // Please see LICENSE for license or visit https://github.com/taocpp/PEGTL/ #ifndef TAO_PEGTL_CONTRIB_IF_THEN_HPP diff --git a/thirdparty/PEGTL/include/tao/pegtl/contrib/integer.hpp b/thirdparty/PEGTL/include/tao/pegtl/contrib/integer.hpp old mode 100644 new mode 100755 index c6f6df9..a1d949d --- a/thirdparty/PEGTL/include/tao/pegtl/contrib/integer.hpp +++ b/thirdparty/PEGTL/include/tao/pegtl/contrib/integer.hpp @@ -1,4 +1,4 @@ -// Copyright (c) 2018 Dr. Colin Hirsch and Daniel Frey +// Copyright (c) 2018-2019 Dr. Colin Hirsch and Daniel Frey // Please see LICENSE for license or visit https://github.com/taocpp/PEGTL/ #ifndef TAO_PEGTL_CONTRIB_INTEGER_HPP @@ -40,7 +40,7 @@ namespace tao template< typename I, typename Input > I convert_positive( const Input& in, std::size_t index ) { - static constexpr I limit = std::numeric_limits< I >::max(); + static constexpr I limit = ( std::numeric_limits< I >::max )(); return actual_convert< I, limit >( in, index ); } @@ -48,7 +48,7 @@ namespace tao I convert_negative( const Input& in, std::size_t index ) { using U = typename std::make_unsigned< I >::type; - static constexpr U limit = static_cast< U >( std::numeric_limits< I >::max() ) + 1; + static constexpr U limit = static_cast< U >( ( std::numeric_limits< I >::max )() ) + 1; return static_cast< I >( ~actual_convert< U, limit >( in, index ) ) + 1; } diff --git a/thirdparty/PEGTL/include/tao/pegtl/contrib/json.hpp b/thirdparty/PEGTL/include/tao/pegtl/contrib/json.hpp old mode 100644 new mode 100755 index 576532c..18710d0 --- a/thirdparty/PEGTL/include/tao/pegtl/contrib/json.hpp +++ b/thirdparty/PEGTL/include/tao/pegtl/contrib/json.hpp @@ -1,4 +1,4 @@ -// Copyright (c) 2014-2018 Dr. Colin Hirsch and Daniel Frey +// Copyright (c) 2014-2019 Dr. Colin Hirsch and Daniel Frey // Please see LICENSE for license or visit https://github.com/taocpp/PEGTL/ #ifndef TAO_PEGTL_CONTRIB_JSON_HPP diff --git a/thirdparty/PEGTL/include/tao/pegtl/contrib/json_pointer.hpp b/thirdparty/PEGTL/include/tao/pegtl/contrib/json_pointer.hpp new file mode 100755 index 0000000..d937b6b --- /dev/null +++ b/thirdparty/PEGTL/include/tao/pegtl/contrib/json_pointer.hpp @@ -0,0 +1,41 @@ +// Copyright (c) 2019 Dr. Colin Hirsch and Daniel Frey +// Please see LICENSE for license or visit https://github.com/taocpp/PEGTL/ + +#ifndef TAO_PEGTL_CONTRIB_JSON_POINTER_HPP +#define TAO_PEGTL_CONTRIB_JSON_POINTER_HPP + +#include "../ascii.hpp" +#include "../config.hpp" +#include "../rules.hpp" +#include "../utf8.hpp" + +namespace tao +{ + namespace TAO_PEGTL_NAMESPACE + { + namespace json_pointer + { + // JSON pointer grammar according to RFC 6901 + + // clang-format off + struct unescaped : utf8::ranges< 0x0, 0x2E, 0x30, 0x7D, 0x7F, 0x10FFFF > {}; + struct escaped : seq< one< '~' >, one< '0', '1' > > {}; + + struct reference_token : star< sor< unescaped, escaped > > {}; + struct json_pointer : star< one< '/' >, reference_token > {}; + // clang-format on + + // relative JSON pointer, see ... + + // clang-format off + struct non_negative_integer : sor< one< '0' >, plus< digit > > {}; + struct relative_json_pointer : seq< non_negative_integer, sor< one< '#' >, json_pointer > > {}; + // clang-format on + + } // namespace json_pointer + + } // namespace TAO_PEGTL_NAMESPACE + +} // namespace tao + +#endif diff --git a/thirdparty/PEGTL/include/tao/pegtl/contrib/parse_tree.hpp b/thirdparty/PEGTL/include/tao/pegtl/contrib/parse_tree.hpp old mode 100644 new mode 100755 index 65d0617..e1ca163 --- a/thirdparty/PEGTL/include/tao/pegtl/contrib/parse_tree.hpp +++ b/thirdparty/PEGTL/include/tao/pegtl/contrib/parse_tree.hpp @@ -1,4 +1,4 @@ -// Copyright (c) 2017-2018 Dr. Colin Hirsch and Daniel Frey +// Copyright (c) 2017-2019 Dr. Colin Hirsch and Daniel Frey // Please see LICENSE for license or visit https://github.com/taocpp/PEGTL/ #ifndef TAO_PEGTL_CONTRIB_PARSE_TREE_HPP @@ -6,11 +6,10 @@ #include #include -#if defined(_MSC_VER) && _MSC_VER == 1900 +#include #include -#endif #include -#include +#include #include #include @@ -22,8 +21,8 @@ #include "../analysis/counted.hpp" #include "../analysis/generic.hpp" -#include "../internal/conditional.hpp" #include "../internal/demangle.hpp" +#include "../internal/integer_sequence.hpp" #include "../internal/iterator.hpp" namespace tao @@ -39,7 +38,7 @@ namespace tao using children_t = std::vector< std::unique_ptr< node_t > >; children_t children; - const std::type_info* id = nullptr; + std::type_index id = std::type_index( typeid( void ) ); std::string source; TAO_PEGTL_NAMESPACE::internal::iterator m_begin; @@ -61,19 +60,19 @@ namespace tao bool is_root() const noexcept { - return id == nullptr; + return id == typeid( void ); } template< typename U > bool is() const noexcept { - return id == &typeid( U ); + return id == typeid( U ); } std::string name() const { assert( !is_root() ); - return TAO_PEGTL_NAMESPACE::internal::demangle( id->name() ); + return TAO_PEGTL_NAMESPACE::internal::demangle( id.name() ); } position begin() const @@ -91,13 +90,19 @@ namespace tao return m_end.data != nullptr; } - std::string content() const + std::string string() const { assert( has_content() ); return std::string( m_begin.data, m_end.data ); } - template< tracking_mode P = tracking_mode::IMMEDIATE, typename Eol = eol::lf_crlf > + // Compatibility, remove with 3.0.0 + std::string content() const + { + return string(); + } + + template< tracking_mode P = tracking_mode::eager, typename Eol = eol::lf_crlf > memory_input< P, Eol > as_memory_input() const { assert( has_content() ); @@ -114,16 +119,16 @@ namespace tao template< typename Rule, typename Input, typename... States > void start( const Input& in, States&&... /*unused*/ ) { - id = &typeid( Rule ); + id = typeid( Rule ); source = in.source(); - m_begin = in.iterator(); + m_begin = TAO_PEGTL_NAMESPACE::internal::iterator( in.iterator() ); } // if parsing of the rule succeeded, this method is called template< typename Rule, typename Input, typename... States > void success( const Input& in, States&&... /*unused*/ ) noexcept { - m_end = in.iterator(); + m_end = TAO_PEGTL_NAMESPACE::internal::iterator( in.iterator() ); } // if parsing of the rule failed, this method is called @@ -137,7 +142,7 @@ namespace tao // note that "child" is the node whose Rule just succeeded // and "*this" is the parent where the node should be appended. template< typename... States > - void emplace_back( std::unique_ptr< node_t > child, States&&... /*unused*/ ) + void emplace_back( std::unique_ptr< node_t >&& child, States&&... /*unused*/ ) { assert( child ); children.emplace_back( std::move( child ) ); @@ -163,27 +168,36 @@ namespace tao void emplace_back() { - stack.emplace_back( std::unique_ptr< Node >( new Node ) ); // NOLINT: std::make_unique requires C++14 + stack.emplace_back( std::unique_ptr< Node >( new Node ) ); } std::unique_ptr< Node >& back() noexcept { + assert( !stack.empty() ); return stack.back(); } void pop_back() noexcept { + assert( !stack.empty() ); return stack.pop_back(); } }; - template< typename Selector, typename... States > - void transform( States&&... /*unused*/ ) noexcept + template< typename Selector, typename... Parameters > + void transform( Parameters&&... /*unused*/ ) noexcept { } - template< typename Selector, typename Node, typename... States > - auto transform( std::unique_ptr< Node >& n, States&&... st ) noexcept( noexcept( Selector::transform( n, st... ) ) ) + template< typename Selector, typename Input, typename Node, typename... States > + auto transform( const Input& in, std::unique_ptr< Node >& n, States&&... st ) noexcept( noexcept( Selector::transform( in, n, st... ) ) ) + -> decltype( Selector::transform( in, n, st... ), void() ) + { + Selector::transform( in, n, st... ); + } + + template< typename Selector, typename Input, typename Node, typename... States > + auto transform( const Input& /*unused*/, std::unique_ptr< Node >& n, States&&... st ) noexcept( noexcept( Selector::transform( n, st... ) ) ) -> decltype( Selector::transform( n, st... ), void() ) { Selector::transform( n, st... ); @@ -201,7 +215,7 @@ namespace tao { }; - template< analysis::rule_type Type, unsigned Count, template< typename... > class Selector > + template< analysis::rule_type Type, std::size_t Count, template< typename... > class Selector > struct is_leaf< 0, analysis::counted< Type, Count >, Selector > : std::true_type { @@ -213,7 +227,7 @@ namespace tao { }; - template< analysis::rule_type Type, unsigned Count, typename... Rules, template< typename... > class Selector > + template< analysis::rule_type Type, std::size_t Count, typename... Rules, template< typename... > class Selector > struct is_leaf< 0, analysis::counted< Type, Count, Rules... >, Selector > : std::false_type { @@ -223,7 +237,14 @@ namespace tao struct bool_sequence; template< bool... Bs > - using is_all = std::is_same< bool_sequence< Bs..., true >, bool_sequence< true, Bs... > >; + struct is_all + : std::is_same< bool_sequence< Bs..., true >, bool_sequence< true, Bs... > > + {}; + + template< bool... Bs > + struct is_none + : std::integral_constant< bool, !is_all< !Bs... >::value > + {}; template< unsigned Level, typename Rule, template< typename... > class Selector > using is_unselected_leaf = std::integral_constant< bool, !Selector< Rule >::value && is_leaf< Level, typename Rule::analyze_t, Selector >::value >; @@ -234,254 +255,157 @@ namespace tao { }; - template< unsigned Level, analysis::rule_type Type, unsigned Count, typename... Rules, template< typename... > class Selector > + template< unsigned Level, analysis::rule_type Type, std::size_t Count, typename... Rules, template< typename... > class Selector > struct is_leaf< Level, analysis::counted< Type, Count, Rules... >, Selector > : is_all< is_unselected_leaf< Level - 1, Rules, Selector >::value... > { }; - template< typename Node, template< typename... > class Selector, template< typename... > class Control > - struct make_control - { - template< typename Rule, bool, bool > - struct control; - - template< typename Rule > - using type = control< Rule, Selector< Rule >::value, is_leaf< 8, typename Rule::analyze_t, Selector >::value >; - }; - - template< typename Node, template< typename... > class Selector, template< typename... > class Control > - template< typename Rule > - struct make_control< Node, Selector, Control >::control< Rule, false, true > - : Control< Rule > + template< typename T > + struct control { -#if defined(_MSC_VER) && _MSC_VER == 1900 - template< typename Input, std::size_t... Is, typename... States > - static void start_impl( const Input& in, std::index_sequence< Is... >, States&&... st ) noexcept( noexcept( Control< Rule >::start( in, std::get< Is >( std::forward_as_tuple ( st... ) )... ) ) ) + template< typename Input, typename Tuple, std::size_t... Is > + static void start_impl( const Input& in, const Tuple& t, TAO_PEGTL_NAMESPACE::internal::index_sequence< Is... > /*unused*/ ) noexcept( noexcept( T::start( in, std::get< sizeof...( Is ) >( t ), std::get< Is >( t )... ) ) ) { - std::get< sizeof...(st) - 1 >( std::forward_as_tuple( st... ) ); // silence C4100 - Control< Rule >::start( in, std::get< Is >( std::forward_as_tuple ( st... ) )... ); + T::start( in, std::get< sizeof...( Is ) >( t ), std::get< Is >( t )... ); + (void)t; } template< typename Input, typename... States > - static void start( const Input& in, States&&... st ) noexcept( noexcept( start_impl( in, std::make_index_sequence< sizeof...( st ) - 1 >{}, std::forward< States >( st )... ) ) ) + static void start( const Input& in, States&&... st ) noexcept( noexcept( start_impl( in, std::tie( st... ), TAO_PEGTL_NAMESPACE::internal::make_index_sequence< sizeof...( st ) - 1 >() ) ) ) { - start_impl( in, std::make_index_sequence< sizeof...( st ) - 1 >{}, std::forward< States >( st )... ); + start_impl( in, std::tie( st... ), TAO_PEGTL_NAMESPACE::internal::make_index_sequence< sizeof...( st ) - 1 >() ); } - template< typename Input, std::size_t... Is, typename... States > - static void success_impl( const Input& in, std::index_sequence< Is... >, States&&... st ) noexcept( noexcept( Control< Rule >::success( in, std::get< Is >( std::forward_as_tuple ( st... ) )... ) ) ) + template< typename Input, typename Tuple, std::size_t... Is > + static void success_impl( const Input& in, const Tuple& t, TAO_PEGTL_NAMESPACE::internal::index_sequence< Is... > /*unused*/ ) noexcept( noexcept( T::success( in, std::get< sizeof...( Is ) >( t ), std::get< Is >( t )... ) ) ) { - std::get< sizeof...(st) - 1 >( std::forward_as_tuple( st... ) ); // silence C4100 - Control< Rule >::success( in, std::get< Is >( std::forward_as_tuple ( st... ) )... ); + T::success( in, std::get< sizeof...( Is ) >( t ), std::get< Is >( t )... ); + (void)t; } template< typename Input, typename... States > - static void success( const Input& in, States&&... st ) noexcept( noexcept( success_impl( in, std::make_index_sequence< sizeof...( st ) - 1 >{}, std::forward< States >( st )... ) ) ) + static void success( const Input& in, States&&... st ) noexcept( noexcept( success_impl( in, std::tie( st... ), TAO_PEGTL_NAMESPACE::internal::make_index_sequence< sizeof...( st ) - 1 >() ) ) ) { - success_impl( in, std::make_index_sequence< sizeof...( st ) - 1 >{}, std::forward< States >( st )... ); + success_impl( in, std::tie( st... ), TAO_PEGTL_NAMESPACE::internal::make_index_sequence< sizeof...( st ) - 1 >() ); } - template< typename Input, std::size_t... Is, typename... States > - static void failure_impl( const Input& in, std::index_sequence< Is... >, States&&... st ) noexcept( noexcept( Control< Rule >::failure( in, std::get< Is >( std::forward_as_tuple ( st... ) )... ) ) ) + template< typename Input, typename Tuple, std::size_t... Is > + static void failure_impl( const Input& in, const Tuple& t, TAO_PEGTL_NAMESPACE::internal::index_sequence< Is... > /*unused*/ ) noexcept( noexcept( T::failure( in, std::get< sizeof...( Is ) >( t ), std::get< Is >( t )... ) ) ) { - std::get< sizeof...(st) - 1 >( std::forward_as_tuple( st... ) ); // silence C4100 - Control< Rule >::failure( in, std::get< Is >( std::forward_as_tuple ( st... ) )... ); + T::failure( in, std::get< sizeof...( Is ) >( t ), std::get< Is >( t )... ); + (void)t; } template< typename Input, typename... States > - static void failure( const Input& in, States&&... st ) noexcept( noexcept( failure_impl( in, std::make_index_sequence< sizeof...( st ) - 1 >{}, std::forward< States >( st )... ) ) ) + static void failure( const Input& in, States&&... st ) noexcept( noexcept( failure_impl( in, std::tie( st... ), TAO_PEGTL_NAMESPACE::internal::make_index_sequence< sizeof...( st ) - 1 >() ) ) ) { - failure_impl( in, std::make_index_sequence< sizeof...( st ) - 1 >{}, std::forward< States >( st )... ); + failure_impl( in, std::tie( st... ), TAO_PEGTL_NAMESPACE::internal::make_index_sequence< sizeof...( st ) - 1 >() ); } - template< typename Input, std::size_t... Is, typename... States > - static void raise_impl( const Input& in, std::index_sequence< Is... >, States&&... st ) noexcept( noexcept( Control< Rule >::raise( in, std::get< Is >( std::forward_as_tuple ( st... ) )... ) ) ) + template< typename Input, typename Tuple, std::size_t... Is > + static void raise_impl( const Input& in, const Tuple& t, TAO_PEGTL_NAMESPACE::internal::index_sequence< Is... > /*unused*/ ) noexcept( noexcept( T::raise( in, std::get< Is >( t )... ) ) ) { - std::get< sizeof...(st) - 1 >( std::forward_as_tuple( st... ) ); // silence C4100 - Control< Rule >::raise( in, std::get< Is >( std::forward_as_tuple ( st... ) )... ); + T::raise( in, std::get< Is >( t )... ); + (void)t; } template< typename Input, typename... States > - static void raise( const Input& in, States&&... st ) noexcept( noexcept( raise_impl( in, std::make_index_sequence< sizeof...( st ) - 1 >{}, std::forward< States >( st )... ) ) ) - { - raise_impl( in, std::make_index_sequence< sizeof...( st ) - 1 >{}, std::forward< States >( st )... ); - } - - template< template< typename... > class Action, typename Input, std::size_t... Is, typename... States > - static auto apply0_impl( const Input& in, std::index_sequence< Is... >, States&&... st ) noexcept( noexcept( Control< Rule >::template apply0< Action >( in, std::get< Is >( std::forward_as_tuple ( st... ) )... ) ) ) - -> decltype( auto ) - { - std::get< sizeof...(st) - 1 >( std::forward_as_tuple( st... ) ); // silence C4100 - return Control< Rule >::template apply0< Action >( in, std::get< Is >( std::forward_as_tuple ( st... ) )... ); - } - - template< template< typename... > class Action, typename Input, typename... States > - static auto apply0( const Input& in, States&&... st ) noexcept( noexcept( apply0_impl< Action >( in, std::make_index_sequence< sizeof...( st ) - 1 >{}, std::forward< States >( st )... ) ) ) - -> decltype( auto ) + static void raise( const Input& in, States&&... st ) noexcept( noexcept( raise_impl( in, std::tie( st... ), TAO_PEGTL_NAMESPACE::internal::make_index_sequence< sizeof...( st ) - 1 >() ) ) ) { - return apply0_impl< Action >( in, std::make_index_sequence< sizeof...( st ) - 1 >{}, std::forward< States >( st )... ); + raise_impl( in, std::tie( st... ), TAO_PEGTL_NAMESPACE::internal::make_index_sequence< sizeof...( st ) - 1 >() ); } - template< template< typename... > class Action, typename Iterator, typename Input, std::size_t... Is, typename... States > - static auto apply_impl( const Iterator& begin, const Input& in, std::index_sequence< Is... >, States&&... st ) noexcept( noexcept( Control< Rule >::template apply< Action >( begin, in, std::get< Is >( std::forward_as_tuple ( st... ) )... ) ) ) - -> decltype( auto ) + template< template< typename... > class Action, typename Iterator, typename Input, typename Tuple, std::size_t... Is > + static auto apply_impl( const Iterator& begin, const Input& in, const Tuple& t, TAO_PEGTL_NAMESPACE::internal::index_sequence< Is... > /*unused*/ ) noexcept( noexcept( T::template apply< Action >( begin, in, std::get< Is >( t )... ) ) ) + -> decltype( T::template apply< Action >( begin, in, std::get< Is >( t )... ) ) { - std::get< sizeof...(st) - 1 >( std::forward_as_tuple( st... ) ); // silence C4100 - return Control< Rule >::template apply< Action >( begin, in, std::get< Is >( std::forward_as_tuple ( st... ) )... ); + return T::template apply< Action >( begin, in, std::get< Is >( t )... ); } template< template< typename... > class Action, typename Iterator, typename Input, typename... States > - static auto apply( const Iterator& begin, const Input& in, States&&... st ) noexcept( noexcept( apply_impl< Action >( begin, in, std::make_index_sequence< sizeof...( st ) - 1 >{}, std::forward< States >( st )... ) ) ) - -> decltype( auto ) + static auto apply( const Iterator& begin, const Input& in, States&&... st ) noexcept( noexcept( apply_impl< Action >( begin, in, std::tie( st... ), TAO_PEGTL_NAMESPACE::internal::make_index_sequence< sizeof...( st ) - 1 >() ) ) ) + -> decltype( apply_impl< Action >( begin, in, std::tie( st... ), TAO_PEGTL_NAMESPACE::internal::make_index_sequence< sizeof...( st ) - 1 >() ) ) { - return apply_impl< Action >( begin, in, std::make_index_sequence< sizeof...( st ) - 1 >{}, std::forward< States >( st )... ); - } -#else - template< typename Input, typename... States > - static void start( const Input& in, States&&... st, state< Node >& /*unused*/ ) noexcept( noexcept( Control< Rule >::start( in, st... ) ) ) - { - Control< Rule >::start( in, st... ); + return apply_impl< Action >( begin, in, std::tie( st... ), TAO_PEGTL_NAMESPACE::internal::make_index_sequence< sizeof...( st ) - 1 >() ); } - template< typename Input, typename... States > - static void success( const Input& in, States&&... st, state< Node >& /*unused*/ ) noexcept( noexcept( Control< Rule >::success( in, st... ) ) ) + template< template< typename... > class Action, typename Input, typename Tuple, std::size_t... Is > + static auto apply0_impl( const Input& in, const Tuple& t, TAO_PEGTL_NAMESPACE::internal::index_sequence< Is... > /*unused*/ ) noexcept( noexcept( T::template apply0< Action >( in, std::get< Is >( t )... ) ) ) + -> decltype( T::template apply0< Action >( in, std::get< Is >( t )... ) ) { - Control< Rule >::success( in, st... ); + return T::template apply0< Action >( in, std::get< Is >( t )... ); } - template< typename Input, typename... States > - static void failure( const Input& in, States&&... st, state< Node >& /*unused*/ ) noexcept( noexcept( Control< Rule >::failure( in, st... ) ) ) + template< template< typename... > class Action, typename Input, typename... States > + static auto apply0( const Input& in, States&&... st ) noexcept( noexcept( apply0_impl< Action >( in, std::tie( st... ), TAO_PEGTL_NAMESPACE::internal::make_index_sequence< sizeof...( st ) - 1 >() ) ) ) + -> decltype( apply0_impl< Action >( in, std::tie( st... ), TAO_PEGTL_NAMESPACE::internal::make_index_sequence< sizeof...( st ) - 1 >() ) ) { - Control< Rule >::failure( in, st... ); + return apply0_impl< Action >( in, std::tie( st... ), TAO_PEGTL_NAMESPACE::internal::make_index_sequence< sizeof...( st ) - 1 >() ); } - template< typename Input, typename... States > - static void raise( const Input& in, States&&... st, state< Node >& /*unused*/ ) + template< apply_mode A, + rewind_mode M, + template< typename... > + class Action, + template< typename... > + class Control, + typename Input, + typename... States > + static bool match( Input& in, States&&... st ) { - Control< Rule >::raise( in, st... ); + return T::template match< A, M, Action, Control >( in, st... ); } + }; - template< template< typename... > class Action, typename Input, typename... States > - static auto apply0( const Input& in, States&&... st, state< Node >& /*unused*/ ) noexcept( noexcept( Control< Rule >::template apply0< Action >( in, st... ) ) ) - -> decltype( Control< Rule >::template apply0< Action >( in, st... ) ) - { - return Control< Rule >::template apply0< Action >( in, st... ); - } + template< typename Node, template< typename... > class Selector, template< typename... > class Control > + struct make_control + { + template< typename Rule, bool, bool > + struct state_handler; - template< template< typename... > class Action, typename Iterator, typename Input, typename... States > - static auto apply( const Iterator& begin, const Input& in, States&&... st, state< Node >& /*unused*/ ) noexcept( noexcept( Control< Rule >::template apply< Action >( begin, in, st... ) ) ) - -> decltype( Control< Rule >::template apply< Action >( begin, in, st... ) ) - { - return Control< Rule >::template apply< Action >( begin, in, st... ); - } -#endif + template< typename Rule > + using type = control< state_handler< Rule, Selector< Rule >::value, is_leaf< 8, typename Rule::analyze_t, Selector >::value > >; }; template< typename Node, template< typename... > class Selector, template< typename... > class Control > template< typename Rule > - struct make_control< Node, Selector, Control >::control< Rule, false, false > + struct make_control< Node, Selector, Control >::state_handler< Rule, false, true > : Control< Rule > { -#if defined(_MSC_VER) && _MSC_VER == 1900 - template< typename Input, std::size_t... Is, typename... States > - static void start_impl( const Input& in, std::index_sequence< Is... >, States&&... st ) - { - Control< Rule >::start( in, std::get< Is >( std::forward_as_tuple ( st... ) )... ); - state< Node >& state = std::get< sizeof...( st ) - 1 >( std::forward_as_tuple( st... ) ); - state.emplace_back(); - } - - template< typename Input, typename... States > - static void start( const Input& in, States&&... st ) noexcept( noexcept( start_impl( in, std::make_index_sequence< sizeof...( st ) - 1 >{}, std::forward< States >( st )... ) ) ) - { - start_impl( in, std::make_index_sequence< sizeof...( st ) - 1 >{}, std::forward< States >( st )... ); - } - - template< typename Input, std::size_t... Is, typename... States > - static void success_impl( const Input& in, std::index_sequence< Is... >, States&&... st ) - { - Control< Rule >::success( in, std::get< Is >( std::forward_as_tuple ( st... ) )... ); - state< Node >& state = std::get< sizeof...( st ) - 1 >( std::forward_as_tuple( st... ) ); - auto n = std::move( state.back() ); - state.pop_back(); - for( auto& c : n->children ) { - state.back()->children.emplace_back( std::move( c ) ); - } - } - template< typename Input, typename... States > - static void success( const Input& in, States&&... st ) noexcept( noexcept( success_impl( in, std::make_index_sequence< sizeof...( st ) - 1 >{}, std::forward< States >( st )... ) ) ) + static void start( const Input& in, state< Node >& /*unused*/, States&&... st ) noexcept( noexcept( Control< Rule >::start( in, st... ) ) ) { - success_impl( in, std::make_index_sequence< sizeof...( st ) - 1 >{}, std::forward< States >( st )... ); - } - - template< typename Input, std::size_t... Is, typename... States > - static void failure_impl( const Input& in, std::index_sequence< Is... >, States&&... st ) - { - Control< Rule >::failure( in, std::get< Is >( std::forward_as_tuple ( st... ) )... ); - state< Node >& state = std::get< sizeof...( st ) - 1 >( std::forward_as_tuple( st... ) ); - state.pop_back(); + Control< Rule >::start( in, st... ); } template< typename Input, typename... States > - static void failure( const Input& in, States&&... st ) noexcept( noexcept( failure_impl( in, std::make_index_sequence< sizeof...( st ) - 1 >{}, std::forward< States >( st )... ) ) ) - { - failure_impl( in, std::make_index_sequence< sizeof...( st ) - 1 >{}, std::forward< States >( st )... ); - } - - template< typename Input, std::size_t... Is, typename... States > - static void raise_impl( const Input& in, std::index_sequence< Is... >, States&&... st ) + static void success( const Input& in, state< Node >& /*unused*/, States&&... st ) noexcept( noexcept( Control< Rule >::success( in, st... ) ) ) { - std::get< sizeof...(st) - 1 >( std::forward_as_tuple( st... ) ); // silence C4100 - Control< Rule >::raise( in, std::get< Is >( std::forward_as_tuple ( st... ) )... ); + Control< Rule >::success( in, st... ); } template< typename Input, typename... States > - static void raise( const Input& in, States&&... st ) - { - raise_impl( in, std::make_index_sequence< sizeof...( st ) - 1 >{}, std::forward< States >( st )... ); - } - - template< template< typename... > class Action, typename Input, std::size_t... Is, typename... States > - static auto apply0_impl( const Input& in, std::index_sequence< Is... >, States&&... st ) noexcept( noexcept( Control< Rule >::template apply0< Action >( in, std::get< Is >( std::forward_as_tuple ( st... ) )... ) ) ) - -> decltype( auto ) + static void failure( const Input& in, state< Node >& /*unused*/, States&&... st ) noexcept( noexcept( Control< Rule >::failure( in, st... ) ) ) { - std::get< sizeof...(st) - 1 >( std::forward_as_tuple( st... ) ); // silence C4100 - return Control< Rule >::template apply0< Action >( in, std::get< Is >( std::forward_as_tuple ( st... ) )... ); - } - - template< template< typename... > class Action, typename Input, typename... States > - static auto apply0( const Input& in, States&&... st ) noexcept( noexcept( apply0_impl< Action >( in, std::make_index_sequence< sizeof...( st ) - 1 >{}, std::forward< States >( st )... ) ) ) - -> decltype( auto ) - { - return apply0_impl< Action >( in, std::make_index_sequence< sizeof...( st ) - 1 >{}, std::forward< States >( st )... ); - } - - template< template< typename... > class Action, typename Iterator, typename Input, std::size_t... Is, typename... States > - static auto apply_impl( const Iterator& begin, const Input& in, std::index_sequence< Is... >, States&&... st ) noexcept( noexcept( Control< Rule >::template apply< Action >( begin, in, std::get< Is >( std::forward_as_tuple ( st... ) )... ) ) ) - -> decltype( auto ) - { - std::get< sizeof...(st) - 1 >( std::forward_as_tuple( st... ) ); // silence C4100 - return Control< Rule >::template apply< Action >( begin, in, std::get< Is >( std::forward_as_tuple ( st... ) )... ); + Control< Rule >::failure( in, st... ); } + }; - template< template< typename... > class Action, typename Iterator, typename Input, typename... States > - static auto apply( const Iterator& begin, const Input& in, States&&... st ) noexcept( noexcept( apply_impl< Action >( begin, in, std::make_index_sequence< sizeof...( st ) - 1 >{}, std::forward< States >( st )... ) ) ) - -> decltype( auto ) - { - return apply_impl< Action >( begin, in, std::make_index_sequence< sizeof...( st ) - 1 >{}, std::forward< States >( st )... ); - } -#else + template< typename Node, template< typename... > class Selector, template< typename... > class Control > + template< typename Rule > + struct make_control< Node, Selector, Control >::state_handler< Rule, false, false > + : Control< Rule > + { template< typename Input, typename... States > - static void start( const Input& in, States&&... st, state< Node >& state ) + static void start( const Input& in, state< Node >& state, States&&... st ) { Control< Rule >::start( in, st... ); state.emplace_back(); } template< typename Input, typename... States > - static void success( const Input& in, States&&... st, state< Node >& state ) + static void success( const Input& in, state< Node >& state, States&&... st ) { Control< Rule >::success( in, st... ); auto n = std::move( state.back() ); @@ -492,135 +416,20 @@ namespace tao } template< typename Input, typename... States > - static void failure( const Input& in, States&&... st, state< Node >& state ) noexcept( noexcept( Control< Rule >::failure( in, st... ) ) ) + static void failure( const Input& in, state< Node >& state, States&&... st ) noexcept( noexcept( Control< Rule >::failure( in, st... ) ) ) { Control< Rule >::failure( in, st... ); state.pop_back(); } - - template< typename Input, typename... States > - static void raise( const Input& in, States&&... st, state< Node >& /*unused*/ ) - { - Control< Rule >::raise( in, st... ); - } - - template< template< typename... > class Action, typename Input, typename... States > - static auto apply0( const Input& in, States&&... st, state< Node >& /*unused*/ ) noexcept( noexcept( Control< Rule >::template apply0< Action >( in, st... ) ) ) - -> decltype( Control< Rule >::template apply0< Action >( in, st... ) ) - { - return Control< Rule >::template apply0< Action >( in, st... ); - } - - template< template< typename... > class Action, typename Iterator, typename Input, typename... States > - static auto apply( const Iterator& begin, const Input& in, States&&... st, state< Node >& /*unused*/ ) noexcept( noexcept( Control< Rule >::template apply< Action >( begin, in, st... ) ) ) - -> decltype( Control< Rule >::template apply< Action >( begin, in, st... ) ) - { - return Control< Rule >::template apply< Action >( begin, in, st... ); - } -#endif }; template< typename Node, template< typename... > class Selector, template< typename... > class Control > template< typename Rule, bool B > - struct make_control< Node, Selector, Control >::control< Rule, true, B > + struct make_control< Node, Selector, Control >::state_handler< Rule, true, B > : Control< Rule > { -#if defined(_MSC_VER) && _MSC_VER == 1900 - template< typename Input, std::size_t... Is, typename... States > - static void start_impl( const Input& in, std::index_sequence< Is... >, States&&... st ) - { - Control< Rule >::start( in, std::get< Is >( std::forward_as_tuple ( st... ) )... ); - state< Node >& state = std::get< sizeof...( st ) - 1 >( std::forward_as_tuple( st... ) ); - state.emplace_back(); - state.back()->template start< Rule >( in, std::get< Is >( std::forward_as_tuple ( st... ) )... ); - } - - template< typename Input, typename... States > - static void start( const Input& in, States&&... st ) noexcept( noexcept( start_impl( in, std::make_index_sequence< sizeof...( st ) - 1 >{}, std::forward< States >( st )... ) ) ) - { - start_impl( in, std::make_index_sequence< sizeof...( st ) - 1 >{}, std::forward< States >( st )... ); - } - - template< typename Input, std::size_t... Is, typename... States > - static void success_impl( const Input& in, std::index_sequence< Is... >, States&&... st ) - { - Control< Rule >::success( in, std::get< Is >( std::forward_as_tuple ( st... ) )... ); - state< Node >& state = std::get< sizeof...( st ) - 1 >( std::forward_as_tuple( st... ) ); - auto n = std::move( state.back() ); - state.pop_back(); - n->template success< Rule >( in, std::get< Is >( std::forward_as_tuple ( st... ) )... ); - transform< Selector< Rule > >( n, std::get< Is >( std::forward_as_tuple ( st... ) )... ); - if( n ) { - state.back()->emplace_back( std::move( n ), std::get< Is >( std::forward_as_tuple ( st... ) )... ); - } - } - - template< typename Input, typename... States > - static void success( const Input& in, States&&... st ) noexcept( noexcept( success_impl( in, std::make_index_sequence< sizeof...( st ) - 1 >{}, std::forward< States >( st )... ) ) ) - { - success_impl( in, std::make_index_sequence< sizeof...( st ) - 1 >{}, std::forward< States >( st )... ); - } - - template< typename Input, std::size_t... Is, typename... States > - static void failure_impl( const Input& in, std::index_sequence< Is... >, States&&... st ) - { - Control< Rule >::failure( in, std::get< Is >( std::forward_as_tuple ( st... ) )... ); - state< Node >& state = std::get< sizeof...( st ) - 1 >( std::forward_as_tuple( st... ) ); - state.back()->template failure< Rule >( in, std::get< Is >( std::forward_as_tuple ( st... ) )... ); - state.pop_back(); - } - - template< typename Input, typename... States > - static void failure( const Input& in, States&&... st ) noexcept( noexcept( failure_impl( in, std::make_index_sequence< sizeof...( st ) - 1 >{}, std::forward< States >( st )... ) ) ) - { - failure_impl( in, std::make_index_sequence< sizeof...( st ) - 1 >{}, std::forward< States >( st )... ); - } - - template< typename Input, std::size_t... Is, typename... States > - static void raise_impl( const Input& in, std::index_sequence< Is... >, States&&... st ) noexcept( noexcept( Control< Rule >::raise( in, std::get< Is >( std::forward_as_tuple ( st... ) )... ) ) ) - { - std::get< sizeof...(st) - 1 >( std::forward_as_tuple( st... ) ); // silence C4100 - Control< Rule >::raise( in, std::get< Is >( std::forward_as_tuple ( st... ) )... ); - } - - template< typename Input, typename... States > - static void raise( const Input& in, States&&... st ) noexcept( noexcept( raise_impl( in, std::make_index_sequence< sizeof...( st ) - 1 >{}, std::forward< States >( st )... ) ) ) - { - raise_impl( in, std::make_index_sequence< sizeof...( st ) - 1 >{}, std::forward< States >( st )... ); - } - - template< template< typename... > class Action, typename Input, std::size_t... Is, typename... States > - static auto apply0_impl( const Input& in, std::index_sequence< Is... >, States&&... st ) noexcept( noexcept( Control< Rule >::template apply0< Action >( in, std::get< Is >( std::forward_as_tuple ( st... ) )... ) ) ) - -> decltype( auto ) - { - std::get< sizeof...(st) - 1 >( std::forward_as_tuple( st... ) ); // silence C4100 - return Control< Rule >::template apply0< Action >( in, std::get< Is >( std::forward_as_tuple ( st... ) )... ); - } - - template< template< typename... > class Action, typename Input, typename... States > - static auto apply0( const Input& in, States&&... st ) noexcept( noexcept( apply0_impl< Action >( in, std::make_index_sequence< sizeof...( st ) - 1 >{}, std::forward< States >( st )... ) ) ) - -> decltype( auto ) - { - return apply0_impl< Action >( in, std::make_index_sequence< sizeof...( st ) - 1 >{}, std::forward< States >( st )... ); - } - - template< template< typename... > class Action, typename Iterator, typename Input, std::size_t... Is, typename... States > - static auto apply_impl( const Iterator& begin, const Input& in, std::index_sequence< Is... >, States&&... st ) noexcept( noexcept( Control< Rule >::template apply< Action >( begin, in, std::get< Is >( std::forward_as_tuple ( st... ) )... ) ) ) - -> decltype( auto ) - { - std::get< sizeof...(st) - 1 >( std::forward_as_tuple( st... ) ); // silence C4100 - return Control< Rule >::template apply< Action >( begin, in, std::get< Is >( std::forward_as_tuple ( st... ) )... ); - } - - template< template< typename... > class Action, typename Iterator, typename Input, typename... States > - static auto apply( const Iterator& begin, const Input& in, States&&... st ) noexcept( noexcept( apply_impl< Action >( begin, in, std::make_index_sequence< sizeof...( st ) - 1 >{}, std::forward< States >( st )... ) ) ) - -> decltype( auto ) - { - return apply_impl< Action >( begin, in, std::make_index_sequence< sizeof...( st ) - 1 >{}, std::forward< States >( st )... ); - } -#else template< typename Input, typename... States > - static void start( const Input& in, States&&... st, state< Node >& state ) + static void start( const Input& in, state< Node >& state, States&&... st ) { Control< Rule >::start( in, st... ); state.emplace_back(); @@ -628,64 +437,82 @@ namespace tao } template< typename Input, typename... States > - static void success( const Input& in, States&&... st, state< Node >& state ) + static void success( const Input& in, state< Node >& state, States&&... st ) { Control< Rule >::success( in, st... ); auto n = std::move( state.back() ); state.pop_back(); n->template success< Rule >( in, st... ); - transform< Selector< Rule > >( n, st... ); + transform< Selector< Rule > >( in, n, st... ); if( n ) { state.back()->emplace_back( std::move( n ), st... ); } } template< typename Input, typename... States > - static void failure( const Input& in, States&&... st, state< Node >& state ) noexcept( noexcept( Control< Rule >::failure( in, st... ) ) && noexcept( std::declval< node& >().template failure< Rule >( in, st... ) ) ) + static void failure( const Input& in, state< Node >& state, States&&... st ) noexcept( noexcept( Control< Rule >::failure( in, st... ) ) && noexcept( std::declval< Node& >().template failure< Rule >( in, st... ) ) ) { Control< Rule >::failure( in, st... ); state.back()->template failure< Rule >( in, st... ); state.pop_back(); } + }; - template< typename Input, typename... States > - static void raise( const Input& in, States&&... st, state< Node >& /*unused*/ ) - { - Control< Rule >::raise( in, st... ); - } + template< typename > + using store_all = std::true_type; - template< template< typename... > class Action, typename Input, typename... States > - static auto apply0( const Input& in, States&&... st, state< Node >& /*unused*/ ) noexcept( noexcept( Control< Rule >::template apply0< Action >( in, st... ) ) ) - -> decltype( Control< Rule >::template apply0< Action >( in, st... ) ) - { - return Control< Rule >::template apply0< Action >( in, st... ); - } + template< typename > + struct selector; - template< template< typename... > class Action, typename Iterator, typename Input, typename... States > - static auto apply( const Iterator& begin, const Input& in, States&&... st, state< Node >& /*unused*/ ) noexcept( noexcept( Control< Rule >::template apply< Action >( begin, in, st... ) ) ) - -> decltype( Control< Rule >::template apply< Action >( begin, in, st... ) ) - { - return Control< Rule >::template apply< Action >( begin, in, st... ); - } -#endif + template<> + struct selector< std::tuple<> > + { + using type = std::false_type; }; - template< typename > - struct element + template< typename T > + struct selector< std::tuple< T > > { + using type = typename T::type; }; - template< typename > - struct store_all : std::true_type + template< typename... Ts > + struct selector< std::tuple< Ts... > > { + static_assert( sizeof...( Ts ) == 0, "multiple matches found" ); }; + template< typename Rule, typename Collection > + using select_tuple = typename std::conditional< Collection::template contains< Rule >::value, std::tuple< Collection >, std::tuple<> >::type; + } // namespace internal - using store_content = std::true_type; + template< typename Rule, typename... Collections > + struct selector + : internal::selector< decltype( std::tuple_cat( std::declval< internal::select_tuple< Rule, Collections > >()... ) ) >::type + {}; + + template< typename Base > + struct apply + : std::true_type + { + template< typename... Rules > + struct on + { + using type = Base; + + template< typename Rule > + using contains = internal::is_none< std::is_same< Rule, Rules >::value... >; + }; + }; + + struct store_content + : apply< store_content > + {}; // some nodes don't need to store their content - struct remove_content : std::true_type + struct remove_content + : apply< remove_content > { template< typename Node, typename... States > static void transform( std::unique_ptr< Node >& n, States&&... st ) noexcept( noexcept( n->Node::remove_content( st... ) ) ) @@ -694,73 +521,38 @@ namespace tao } }; - // if a node has only one child, replace the node with its child, otherwise apply B - template< typename Base > - struct fold_one_or : Base + // if a node has only one child, replace the node with its child, otherwise remove content + struct fold_one + : apply< fold_one > { template< typename Node, typename... States > - static void transform( std::unique_ptr< Node >& n, States&&... st ) noexcept( noexcept( n->children.size(), Base::transform( n, st... ) ) ) + static void transform( std::unique_ptr< Node >& n, States&&... st ) noexcept( noexcept( n->children.size(), n->Node::remove_content( st... ) ) ) { if( n->children.size() == 1 ) { n = std::move( n->children.front() ); } else { - Base::transform( n, st... ); + n->remove_content( st... ); } } }; - // if a node has no children, discard the node, otherwise apply B - template< typename Base > - struct discard_empty_or : Base + // if a node has no children, discard the node, otherwise remove content + struct discard_empty + : apply< discard_empty > { template< typename Node, typename... States > - static void transform( std::unique_ptr< Node >& n, States&&... st ) noexcept( noexcept( n->children.empty(), Base::transform( n, st... ) ) ) + static void transform( std::unique_ptr< Node >& n, States&&... st ) noexcept( noexcept( n->children.empty(), n->Node::remove_content( st... ) ) ) { if( n->children.empty() ) { n.reset(); } else { - Base::transform( n, st... ); + n->remove_content( st... ); } } }; - using fold_one = fold_one_or< remove_content >; - using discard_empty = discard_empty_or< remove_content >; - - template< typename Rule, typename... Collections > - struct selector : std::false_type - { - }; - - // TODO: Implement in a non-recursive way - // TODO: Check for multiple matches (currently: first match wins) - template< typename Rule, typename Collection, typename... Collections > - struct selector< Rule, Collection, Collections... > - : TAO_PEGTL_NAMESPACE::internal::conditional< Collection::template contains< Rule >::value >::template type< typename Collection::type, selector< Rule, Collections... > > - { - }; - - template< typename Base > - struct apply - { - template< typename... Rules > - struct to - : internal::element< Rules >... - { - using type = Base; - - template< typename Rule > - using contains = std::is_base_of< internal::element< Rule >, to >; - }; - }; - - using apply_store_content = apply< store_content >; - using apply_remove_content = apply< remove_content >; - using apply_fold_one = apply< fold_one >; - using apply_discard_empty = apply< discard_empty >; - template< typename Rule, typename Node, template< typename... > class Selector = internal::store_all, diff --git a/thirdparty/PEGTL/include/tao/pegtl/contrib/parse_tree_to_dot.hpp b/thirdparty/PEGTL/include/tao/pegtl/contrib/parse_tree_to_dot.hpp new file mode 100755 index 0000000..beae7a0 --- /dev/null +++ b/thirdparty/PEGTL/include/tao/pegtl/contrib/parse_tree_to_dot.hpp @@ -0,0 +1,116 @@ +// Copyright (c) 2019 Dr. Colin Hirsch and Daniel Frey +// Please see LICENSE for license or visit https://github.com/taocpp/PEGTL/ + +#ifndef TAO_PEGTL_CONTRIB_PARSE_TREE_TO_DOT_HPP +#define TAO_PEGTL_CONTRIB_PARSE_TREE_TO_DOT_HPP + +#include +#include +#include + +#include "parse_tree.hpp" + +namespace tao +{ + namespace TAO_PEGTL_NAMESPACE + { + namespace parse_tree + { + namespace internal + { + inline void escape( std::ostream& os, const char* p, const std::size_t s ) + { + static const char* h = "0123456789abcdef"; + + const char* l = p; + const char* const e = p + s; + while( p != e ) { + const unsigned char c = *p; + if( c == '\\' ) { + os.write( l, p - l ); + l = ++p; + os << "\\\\"; + } + else if( c == '"' ) { + os.write( l, p - l ); + l = ++p; + os << "\\\""; + } + else if( c < 32 ) { + os.write( l, p - l ); + l = ++p; + switch( c ) { + case '\b': + os << "\\b"; + break; + case '\f': + os << "\\f"; + break; + case '\n': + os << "\\n"; + break; + case '\r': + os << "\\r"; + break; + case '\t': + os << "\\t"; + break; + default: + os << "\\u00" << h[ ( c & 0xf0 ) >> 4 ] << h[ c & 0x0f ]; + } + } + else if( c == 127 ) { + os.write( l, p - l ); + l = ++p; + os << "\\u007f"; + } + else { + ++p; + } + } + os.write( l, p - l ); + } + + inline void escape( std::ostream& os, const std::string& s ) + { + escape( os, s.data(), s.size() ); + } + + template< typename Node > + void print_dot_node( std::ostream& os, const Node& n, const std::string& s ) + { + os << " x" << &n << " [ label=\""; + escape( os, s ); + if( n.has_content() ) { + os << "\\n"; + escape( os, n.m_begin.data, n.m_end.data - n.m_begin.data ); + } + os << "\" ]\n"; + if( !n.children.empty() ) { + os << " x" << &n << " -> { "; + for( auto& up : n.children ) { + os << "x" << up.get() << ( ( up == n.children.back() ) ? " }\n" : ", " ); + } + for( auto& up : n.children ) { + print_dot_node( os, *up, up->name() ); + } + } + } + + } // namespace internal + + template< typename Node > + void print_dot( std::ostream& os, const Node& n ) + { + os << "digraph parse_tree\n{\n"; + internal::print_dot_node( os, n, n.is_root() ? "ROOT" : n.name() ); + os << "}\n"; + } + + } // namespace parse_tree + + } // namespace TAO_PEGTL_NAMESPACE + +} // namespace tao + +#endif diff --git a/thirdparty/PEGTL/include/tao/pegtl/contrib/raw_string.hpp b/thirdparty/PEGTL/include/tao/pegtl/contrib/raw_string.hpp old mode 100644 new mode 100755 index 0ed6d1c..a569643 --- a/thirdparty/PEGTL/include/tao/pegtl/contrib/raw_string.hpp +++ b/thirdparty/PEGTL/include/tao/pegtl/contrib/raw_string.hpp @@ -1,4 +1,4 @@ -// Copyright (c) 2014-2018 Dr. Colin Hirsch and Daniel Frey +// Copyright (c) 2014-2019 Dr. Colin Hirsch and Daniel Frey // Please see LICENSE for license or visit https://github.com/taocpp/PEGTL/ #ifndef TAO_PEGTL_CONTRIB_RAW_STRING_HPP @@ -32,12 +32,14 @@ namespace tao template< char Open, char Marker > struct raw_string_open { - using analyze_t = analysis::generic< analysis::rule_type::ANY >; + using analyze_t = analysis::generic< analysis::rule_type::any >; template< apply_mode A, rewind_mode, - template< typename... > class Action, - template< typename... > class Control, + template< typename... > + class Action, + template< typename... > + class Control, typename Input, typename... States > static bool match( Input& in, std::size_t& marker_size, States&&... /*unused*/ ) noexcept( noexcept( in.size( 0 ) ) ) @@ -70,12 +72,14 @@ namespace tao template< char Marker, char Close > struct at_raw_string_close { - using analyze_t = analysis::generic< analysis::rule_type::OPT >; + using analyze_t = analysis::generic< analysis::rule_type::opt >; template< apply_mode A, rewind_mode, - template< typename... > class Action, - template< typename... > class Control, + template< typename... > + class Action, + template< typename... > + class Control, typename Input, typename... States > static bool match( Input& in, const std::size_t& marker_size, States&&... /*unused*/ ) noexcept( noexcept( in.size( 0 ) ) ) @@ -109,19 +113,21 @@ namespace tao template< typename Cond > struct raw_string_until< Cond > { - using analyze_t = analysis::generic< analysis::rule_type::SEQ, star< not_at< Cond >, not_at< eof >, bytes< 1 > >, Cond >; + using analyze_t = analysis::generic< analysis::rule_type::seq, star< not_at< Cond >, not_at< eof >, bytes< 1 > >, Cond >; template< apply_mode A, rewind_mode M, - template< typename... > class Action, - template< typename... > class Control, + template< typename... > + class Action, + template< typename... > + class Control, typename Input, typename... States > static bool match( Input& in, const std::size_t& marker_size, States&&... st ) { auto m = in.template mark< M >(); - while( !Control< Cond >::template match< A, rewind_mode::REQUIRED, Action, Control >( in, marker_size, st... ) ) { + while( !Control< Cond >::template match< A, rewind_mode::required, Action, Control >( in, marker_size, st... ) ) { if( in.empty() ) { return false; } @@ -134,12 +140,14 @@ namespace tao template< typename Cond, typename... Rules > struct raw_string_until { - using analyze_t = analysis::generic< analysis::rule_type::SEQ, star< not_at< Cond >, not_at< eof >, Rules... >, Cond >; + using analyze_t = analysis::generic< analysis::rule_type::seq, star< not_at< Cond >, not_at< eof >, Rules... >, Cond >; template< apply_mode A, rewind_mode M, - template< typename... > class Action, - template< typename... > class Control, + template< typename... > + class Action, + template< typename... > + class Control, typename Input, typename... States > static bool match( Input& in, const std::size_t& marker_size, States&&... st ) @@ -147,7 +155,7 @@ namespace tao auto m = in.template mark< M >(); using m_t = decltype( m ); - while( !Control< Cond >::template match< A, rewind_mode::REQUIRED, Action, Control >( in, marker_size, st... ) ) { + while( !Control< Cond >::template match< A, rewind_mode::required, Action, Control >( in, marker_size, st... ) ) { if( in.empty() || ( !rule_conjunction< Rules... >::template match< A, m_t::next_rewind_mode, Action, Control >( in, st... ) ) ) { return false; } @@ -202,8 +210,10 @@ namespace tao template< apply_mode A, rewind_mode M, - template< typename... > class Action, - template< typename... > class Control, + template< typename... > + class Action, + template< typename... > + class Control, typename Input, typename... States > static bool match( Input& in, States&&... st ) diff --git a/thirdparty/PEGTL/include/tao/pegtl/contrib/remove_first_state.hpp b/thirdparty/PEGTL/include/tao/pegtl/contrib/remove_first_state.hpp new file mode 100755 index 0000000..d9fbbff --- /dev/null +++ b/thirdparty/PEGTL/include/tao/pegtl/contrib/remove_first_state.hpp @@ -0,0 +1,88 @@ +// Copyright (c) 2019 Dr. Colin Hirsch and Daniel Frey +// Please see LICENSE for license or visit https://github.com/taocpp/PEGTL/ + +#ifndef TAO_PEGTL_CONTRIB_REMOVE_FIRST_STATE_HPP +#define TAO_PEGTL_CONTRIB_REMOVE_FIRST_STATE_HPP + +#include "../config.hpp" + +namespace tao +{ + namespace TAO_PEGTL_NAMESPACE + { + // NOTE: The naming of the following classes might still change. + + template< typename Base > + struct remove_first_state_after_match + : Base + { + template< typename Input, typename State, typename... States > + static void start( const Input& in, State&& /*unused*/, States&&... st ) noexcept( noexcept( Base::start( in, st... ) ) ) + { + Base::start( in, st... ); + } + + template< typename Input, typename State, typename... States > + static void success( const Input& in, State&& /*unused*/, States&&... st ) noexcept( noexcept( Base::success( in, st... ) ) ) + { + Base::success( in, st... ); + } + + template< typename Input, typename State, typename... States > + static void failure( const Input& in, State&& /*unused*/, States&&... st ) noexcept( noexcept( Base::failure( in, st... ) ) ) + { + Base::failure( in, st... ); + } + + template< typename Input, typename State, typename... States > + static void raise( const Input& in, State&& /*unused*/, States&&... st ) + { + Base::raise( in, st... ); + } + + template< template< typename... > class Action, + typename Iterator, + typename Input, + typename State, + typename... States > + static auto apply( const Iterator& begin, const Input& in, State&& /*unused*/, States&&... st ) noexcept( noexcept( Base::template apply< Action >( begin, in, st... ) ) ) + -> decltype( Base::template apply< Action >( begin, in, st... ) ) + { + return Base::template apply< Action >( begin, in, st... ); + } + + template< template< typename... > class Action, + typename Input, + typename State, + typename... States > + static auto apply0( const Input& in, State&& /*unused*/, States&&... st ) noexcept( noexcept( Base::template apply0< Action >( in, st... ) ) ) + -> decltype( Base::template apply0< Action >( in, st... ) ) + { + return Base::template apply0< Action >( in, st... ); + } + }; + + template< typename Rule, template< typename... > class Control > + struct remove_self_and_first_state + : Control< Rule > + { + template< apply_mode A, + rewind_mode M, + template< typename... > + class Action, + template< typename... > + class, + typename Input, + typename State, + typename... States > + static bool match( Input& in, State&& /*unused*/, States&&... st ) + { + return Control< Rule >::template match< A, M, Action, Control >( in, st... ); + } + }; + + } // namespace TAO_PEGTL_NAMESPACE + +} // namespace tao + +#endif diff --git a/thirdparty/PEGTL/include/tao/pegtl/contrib/rep_one_min_max.hpp b/thirdparty/PEGTL/include/tao/pegtl/contrib/rep_one_min_max.hpp old mode 100644 new mode 100755 index 99014d0..cd7faa9 --- a/thirdparty/PEGTL/include/tao/pegtl/contrib/rep_one_min_max.hpp +++ b/thirdparty/PEGTL/include/tao/pegtl/contrib/rep_one_min_max.hpp @@ -1,4 +1,4 @@ -// Copyright (c) 2017-2018 Dr. Colin Hirsch and Daniel Frey +// Copyright (c) 2017-2019 Dr. Colin Hirsch and Daniel Frey // Please see LICENSE for license or visit https://github.com/taocpp/PEGTL/ #ifndef TAO_PEGTL_CONTRIB_REP_ONE_MIN_MAX_HPP @@ -22,7 +22,7 @@ namespace tao template< unsigned Min, unsigned Max, char C > struct rep_one_min_max { - using analyze_t = analysis::counted< analysis::rule_type::ANY, Min >; + using analyze_t = analysis::counted< analysis::rule_type::any, Min >; static_assert( Min <= Max, "invalid rep_one_min_max rule (maximum number of repetitions smaller than minimum)" ); @@ -38,7 +38,7 @@ namespace tao ++i; } if( ( Min <= i ) && ( i <= Max ) ) { - bump_help< result_on_found::SUCCESS, Input, char, C >( in, i ); + bump_help< result_on_found::success, Input, char, C >( in, i ); return true; } return false; @@ -59,10 +59,6 @@ namespace tao { }; - struct ellipsis : internal::rep_one_min_max< 3, 3, '.' > - { - }; - } // namespace ascii } // namespace TAO_PEGTL_NAMESPACE diff --git a/thirdparty/PEGTL/include/tao/pegtl/contrib/rep_string.hpp b/thirdparty/PEGTL/include/tao/pegtl/contrib/rep_string.hpp new file mode 100755 index 0000000..a4317f2 --- /dev/null +++ b/thirdparty/PEGTL/include/tao/pegtl/contrib/rep_string.hpp @@ -0,0 +1,47 @@ +// Copyright (c) 2019 Dr. Colin Hirsch and Daniel Frey +// Please see LICENSE for license or visit https://github.com/taocpp/PEGTL/ + +#ifndef TAO_PEGTL_CONTRIB_REP_STRING_HPP +#define TAO_PEGTL_CONTRIB_REP_STRING_HPP + +#include + +#include "../config.hpp" +#include "../internal/string.hpp" + +namespace tao +{ + namespace TAO_PEGTL_NAMESPACE + { + namespace internal + { + template< std::size_t, typename, char... > + struct make_rep_string; + + template< char... Ss, char... Cs > + struct make_rep_string< 0, string< Ss... >, Cs... > + { + using type = string< Ss... >; + }; + + template< std::size_t N, char... Ss, char... Cs > + struct make_rep_string< N, string< Ss... >, Cs... > + : make_rep_string< N - 1, string< Ss..., Cs... >, Cs... > + {}; + + } // namespace internal + + inline namespace ascii + { + template< std::size_t N, char... Cs > + struct rep_string + : internal::make_rep_string< N, internal::string<>, Cs... >::type + {}; + + } // namespace ascii + + } // namespace TAO_PEGTL_NAMESPACE + +} // namespace tao + +#endif diff --git a/thirdparty/PEGTL/include/tao/pegtl/contrib/to_string.hpp b/thirdparty/PEGTL/include/tao/pegtl/contrib/to_string.hpp old mode 100644 new mode 100755 index ff60aa0..e47cadf --- a/thirdparty/PEGTL/include/tao/pegtl/contrib/to_string.hpp +++ b/thirdparty/PEGTL/include/tao/pegtl/contrib/to_string.hpp @@ -1,4 +1,4 @@ -// Copyright (c) 2017-2018 Dr. Colin Hirsch and Daniel Frey +// Copyright (c) 2017-2019 Dr. Colin Hirsch and Daniel Frey // Please see LICENSE for license or visit https://github.com/taocpp/PEGTL/ #ifndef TAO_PEGTL_CONTRIB_TO_STRING_HPP diff --git a/thirdparty/PEGTL/include/tao/pegtl/contrib/tracer.hpp b/thirdparty/PEGTL/include/tao/pegtl/contrib/tracer.hpp old mode 100644 new mode 100755 index 1c632d3..245fbf6 --- a/thirdparty/PEGTL/include/tao/pegtl/contrib/tracer.hpp +++ b/thirdparty/PEGTL/include/tao/pegtl/contrib/tracer.hpp @@ -1,4 +1,4 @@ -// Copyright (c) 2014-2018 Dr. Colin Hirsch and Daniel Frey +// Copyright (c) 2014-2019 Dr. Colin Hirsch and Daniel Frey // Please see LICENSE for license or visit https://github.com/taocpp/PEGTL/ #ifndef TAO_PEGTL_CONTRIB_TRACER_HPP @@ -19,6 +19,40 @@ namespace tao { namespace TAO_PEGTL_NAMESPACE { + namespace internal + { + template< typename Input > + void print_current( const Input& in ) + { + if( in.empty() ) { + std::cerr << ""; + } + else { + const auto c = in.peek_uint8(); + switch( c ) { + case 0: + std::cerr << " = "; + break; + case 9: + std::cerr << " = "; + break; + case 10: + std::cerr << " = "; + break; + case 13: + std::cerr << " = "; + break; + default: + if( isprint( c ) ) { + std::cerr << '\'' << c << "' = "; + } + } + std::cerr << "(char)" << unsigned( c ); + } + } + + } // namespace internal + struct trace_state { unsigned rule = 0; @@ -26,6 +60,8 @@ namespace tao std::vector< unsigned > stack; }; +#if defined( _MSC_VER ) && ( _MSC_VER < 1910 ) + template< typename Rule > struct tracer : normal< Rule > @@ -33,27 +69,33 @@ namespace tao template< typename Input, typename... States > static void start( const Input& in, States&&... /*unused*/ ) { - std::cerr << in.position() << " start " << internal::demangle< Rule >() << std::endl; + std::cerr << in.position() << " start " << internal::demangle< Rule >() << "; current "; + print_current( in ); + std::cerr << std::endl; } - template< typename Input > - static void start( const Input& in, trace_state& ts ) + template< typename Input, typename... States > + static void start( const Input& in, trace_state& ts, States&&... st ) { - std::cerr << std::setw( 6 ) << ++ts.line << " " << std::setw( 6 ) << ++ts.rule << " " << in.position() << " start " << internal::demangle< Rule >() << std::endl; + std::cerr << std::setw( 6 ) << ++ts.line << " " << std::setw( 6 ) << ++ts.rule << " "; + start( in, st... ); ts.stack.push_back( ts.rule ); } template< typename Input, typename... States > static void success( const Input& in, States&&... /*unused*/ ) { - std::cerr << in.position() << " success " << internal::demangle< Rule >() << std::endl; + std::cerr << in.position() << " success " << internal::demangle< Rule >() << "; next "; + print_current( in ); + std::cerr << std::endl; } - template< typename Input > - static void success( const Input& in, trace_state& ts ) + template< typename Input, typename... States > + static void success( const Input& in, trace_state& ts, States&&... st ) { assert( !ts.stack.empty() ); - std::cerr << std::setw( 6 ) << ++ts.line << " " << std::setw( 6 ) << ts.stack.back() << " " << in.position() << " success " << internal::demangle< Rule >() << std::endl; + std::cerr << std::setw( 6 ) << ++ts.line << " " << std::setw( 6 ) << ts.stack.back() << " "; + success( in, st... ); ts.stack.pop_back(); } @@ -63,51 +105,147 @@ namespace tao std::cerr << in.position() << " failure " << internal::demangle< Rule >() << std::endl; } - template< typename Input > - static void failure( const Input& in, trace_state& ts ) + template< typename Input, typename... States > + static void failure( const Input& in, trace_state& ts, States&&... st ) { assert( !ts.stack.empty() ); - std::cerr << std::setw( 6 ) << ++ts.line << " " << std::setw( 6 ) << ts.stack.back() << " " << in.position() << " failure " << internal::demangle< Rule >() << std::endl; + std::cerr << std::setw( 6 ) << ++ts.line << " " << std::setw( 6 ) << ts.stack.back() << " "; + failure( in, st... ); ts.stack.pop_back(); } - template< template< typename... > class Action, typename Input, typename... States > - static auto apply0( const Input& /*unused*/, States&&... st ) - -> decltype( Action< Rule >::apply0( st... ) ) + template< template< typename... > class Action, typename Iterator, typename Input, typename... States > + static auto apply( const Iterator& begin, const Input& in, States&&... st ) + -> decltype( normal< Rule >::template apply< Action >( begin, in, st... ) ) { - std::cerr << "apply0 " << internal::demangle< Action< Rule > >() << std::endl; - return Action< Rule >::apply0( st... ); + std::cerr << in.position() << " apply " << internal::demangle< Rule >() << std::endl; + return normal< Rule >::template apply< Action >( begin, in, st... ); } - template< template< typename... > class Action, typename Input, typename... States > - static auto apply0( const Input& /*unused*/, trace_state& ts, States&&... st ) - -> decltype( Action< Rule >::apply0( ts, st... ) ) + template< template< typename... > class Action, typename Iterator, typename Input, typename... States > + static auto apply( const Iterator& begin, const Input& in, trace_state& ts, States&&... st ) + -> decltype( apply< Action >( begin, in, st... ) ) { - std::cerr << std::setw( 6 ) << ++ts.line << " " << internal::demangle< Action< Rule > >() << "::apply0()" << std::endl; - return Action< Rule >::apply0( ts, st... ); + std::cerr << std::setw( 6 ) << ++ts.line << " "; + return apply< Action >( begin, in, st... ); } - template< template< typename... > class Action, typename Iterator, typename Input, typename... States > - static auto apply( const Iterator& begin, const Input& in, States&&... st ) - -> decltype( Action< Rule >::apply( std::declval< typename Input::action_t >(), st... ) ) + template< template< typename... > class Action, typename Input, typename... States > + static auto apply0( const Input& in, States&&... st ) + -> decltype( normal< Rule >::template apply0< Action >( in, st... ) ) { - std::cerr << "apply " << internal::demangle< Action< Rule > >() << std::endl; - using action_t = typename Input::action_t; - const action_t action_input( begin, in ); - return Action< Rule >::apply( action_input, st... ); + std::cerr << in.position() << " apply0 " << internal::demangle< Rule >() << std::endl; + return normal< Rule >::template apply0< Action >( in, st... ); } - template< template< typename... > class Action, typename Iterator, typename Input, typename... States > - static auto apply( const Iterator& begin, const Input& in, trace_state& ts, States&&... st ) - -> decltype( Action< Rule >::apply( std::declval< typename Input::action_t >(), ts, st... ) ) + template< template< typename... > class Action, typename Input, typename... States > + static auto apply0( const Input& in, trace_state& ts, States&&... st ) + -> decltype( apply0< Action >( in, st... ) ) { - std::cerr << std::setw( 6 ) << ++ts.line << " " << internal::demangle< Action< Rule > >() << "::apply()" << std::endl; - using action_t = typename Input::action_t; - const action_t action_input( begin, in ); - return Action< Rule >::apply( action_input, ts, st... ); + std::cerr << std::setw( 6 ) << ++ts.line << " "; + return apply0< Action >( in, st... ); } }; +#else + + template< template< typename... > class Base > + struct trace + { + template< typename Rule > + struct control + : Base< Rule > + { + template< typename Input, typename... States > + static void start( const Input& in, States&&... st ) + { + std::cerr << in.position() << " start " << internal::demangle< Rule >() << "; current "; + print_current( in ); + std::cerr << std::endl; + Base< Rule >::start( in, st... ); + } + + template< typename Input, typename... States > + static void start( const Input& in, trace_state& ts, States&&... st ) + { + std::cerr << std::setw( 6 ) << ++ts.line << " " << std::setw( 6 ) << ++ts.rule << " "; + start( in, st... ); + ts.stack.push_back( ts.rule ); + } + + template< typename Input, typename... States > + static void success( const Input& in, States&&... st ) + { + std::cerr << in.position() << " success " << internal::demangle< Rule >() << "; next "; + print_current( in ); + std::cerr << std::endl; + Base< Rule >::success( in, st... ); + } + + template< typename Input, typename... States > + static void success( const Input& in, trace_state& ts, States&&... st ) + { + assert( !ts.stack.empty() ); + std::cerr << std::setw( 6 ) << ++ts.line << " " << std::setw( 6 ) << ts.stack.back() << " "; + success( in, st... ); + ts.stack.pop_back(); + } + + template< typename Input, typename... States > + static void failure( const Input& in, States&&... st ) + { + std::cerr << in.position() << " failure " << internal::demangle< Rule >() << std::endl; + Base< Rule >::failure( in, st... ); + } + + template< typename Input, typename... States > + static void failure( const Input& in, trace_state& ts, States&&... st ) + { + assert( !ts.stack.empty() ); + std::cerr << std::setw( 6 ) << ++ts.line << " " << std::setw( 6 ) << ts.stack.back() << " "; + failure( in, st... ); + ts.stack.pop_back(); + } + + template< template< typename... > class Action, typename Iterator, typename Input, typename... States > + static auto apply( const Iterator& begin, const Input& in, States&&... st ) + -> decltype( Base< Rule >::template apply< Action >( begin, in, st... ) ) + { + std::cerr << in.position() << " apply " << internal::demangle< Rule >() << std::endl; + return Base< Rule >::template apply< Action >( begin, in, st... ); + } + + template< template< typename... > class Action, typename Iterator, typename Input, typename... States > + static auto apply( const Iterator& begin, const Input& in, trace_state& ts, States&&... st ) + -> decltype( apply< Action >( begin, in, st... ) ) + { + std::cerr << std::setw( 6 ) << ++ts.line << " "; + return apply< Action >( begin, in, st... ); + } + + template< template< typename... > class Action, typename Input, typename... States > + static auto apply0( const Input& in, States&&... st ) + -> decltype( Base< Rule >::template apply0< Action >( in, st... ) ) + { + std::cerr << in.position() << " apply0 " << internal::demangle< Rule >() << std::endl; + return Base< Rule >::template apply0< Action >( in, st... ); + } + + template< template< typename... > class Action, typename Input, typename... States > + static auto apply0( const Input& in, trace_state& ts, States&&... st ) + -> decltype( apply0< Action >( in, st... ) ) + { + std::cerr << std::setw( 6 ) << ++ts.line << " "; + return apply0< Action >( in, st... ); + } + }; + }; + + template< typename Rule > + using tracer = trace< normal >::control< Rule >; + +#endif + } // namespace TAO_PEGTL_NAMESPACE } // namespace tao diff --git a/thirdparty/PEGTL/include/tao/pegtl/contrib/unescape.hpp b/thirdparty/PEGTL/include/tao/pegtl/contrib/unescape.hpp old mode 100644 new mode 100755 index a09ba30..5bc0dbd --- a/thirdparty/PEGTL/include/tao/pegtl/contrib/unescape.hpp +++ b/thirdparty/PEGTL/include/tao/pegtl/contrib/unescape.hpp @@ -1,4 +1,4 @@ -// Copyright (c) 2014-2018 Dr. Colin Hirsch and Daniel Frey +// Copyright (c) 2014-2019 Dr. Colin Hirsch and Daniel Frey // Please see LICENSE for license or visit https://github.com/taocpp/PEGTL/ #ifndef TAO_PEGTL_CONTRIB_UNESCAPE_HPP @@ -17,11 +17,6 @@ namespace tao { namespace unescape { - struct state - { - std::string unescaped; - }; - // Utility functions for the unescape actions. inline bool utf8_append_utf32( std::string& string, const unsigned utf32 ) @@ -31,7 +26,7 @@ namespace tao return true; } if( utf32 <= 0x7ff ) { - char tmp[] = { char( ( ( utf32 & 0x7c0 ) >> 6 ) | 0xc0 ), + char tmp[] = { char( ( ( utf32 & 0x7c0 ) >> 6 ) | 0xc0 ), // NOLINT char( ( ( utf32 & 0x03f ) ) | 0x80 ) }; string.append( tmp, sizeof( tmp ) ); return true; @@ -41,14 +36,14 @@ namespace tao // nope, this is a UTF-16 surrogate return false; } - char tmp[] = { char( ( ( utf32 & 0xf000 ) >> 12 ) | 0xe0 ), + char tmp[] = { char( ( ( utf32 & 0xf000 ) >> 12 ) | 0xe0 ), // NOLINT char( ( ( utf32 & 0x0fc0 ) >> 6 ) | 0x80 ), char( ( ( utf32 & 0x003f ) ) | 0x80 ) }; string.append( tmp, sizeof( tmp ) ); return true; } if( utf32 <= 0x10ffff ) { - char tmp[] = { char( ( ( utf32 & 0x1c0000 ) >> 18 ) | 0xf0 ), + char tmp[] = { char( ( ( utf32 & 0x1c0000 ) >> 18 ) | 0xf0 ), // NOLINT char( ( ( utf32 & 0x03f000 ) >> 12 ) | 0x80 ), char( ( ( utf32 & 0x000fc0 ) >> 6 ) | 0x80 ), char( ( ( utf32 & 0x00003f ) ) | 0x80 ) }; @@ -58,7 +53,7 @@ namespace tao return false; } - // This function MUST only be called for characters matching tao::TAO_PEGTL_NAMESPACE::ascii::xdigit! + // This function MUST only be called for characters matching TAO_PEGTL_NAMESPACE::ascii::xdigit! template< typename I > I unhex_char( const char c ) { @@ -88,8 +83,9 @@ namespace tao case 'E': case 'F': return I( c - 'A' + 10 ); + default: // LCOV_EXCL_LINE + throw std::runtime_error( "invalid character in unhex" ); // NOLINT, LCOV_EXCL_LINE } - throw std::runtime_error( "invalid character in unhex" ); // NOLINT, LCOV_EXCL_LINE } template< typename I > @@ -107,22 +103,22 @@ namespace tao struct append_all { - template< typename Input, typename State, typename... States > - static void apply( const Input& in, State& st, States&&... /*unused*/ ) + template< typename Input > + static void apply( const Input& in, std::string& s ) { - st.unescaped.append( in.begin(), in.size() ); + s.append( in.begin(), in.size() ); } }; - // This action MUST be called for a character matching T which MUST be tao::TAO_PEGTL_NAMESPACE::one< ... >. + // This action MUST be called for a character matching T which MUST be TAO_PEGTL_NAMESPACE::one< ... >. template< typename T, char... Rs > struct unescape_c { - template< typename Input, typename State, typename... States > - static void apply( const Input& in, State& st, States&&... /*unused*/ ) + template< typename Input > + static void apply( const Input& in, std::string& s ) { assert( in.size() == 1 ); - st.unescaped += apply_one( in, static_cast< const T* >( nullptr ) ); + s += apply_one( in, static_cast< const T* >( nullptr ) ); } template< typename Input, char... Qs > @@ -151,11 +147,11 @@ namespace tao struct unescape_u { - template< typename Input, typename State, typename... States > - static void apply( const Input& in, State& st, States&&... /*unused*/ ) + template< typename Input > + static void apply( const Input& in, std::string& s ) { assert( !in.empty() ); // First character MUST be present, usually 'u' or 'U'. - if( !utf8_append_utf32( st.unescaped, unhex_string< unsigned >( in.begin() + 1, in.end() ) ) ) { + if( !utf8_append_utf32( s, unhex_string< unsigned >( in.begin() + 1, in.end() ) ) ) { throw parse_error( "invalid escaped unicode code point", in ); } } @@ -163,11 +159,11 @@ namespace tao struct unescape_x { - template< typename Input, typename State, typename... States > - static void apply( const Input& in, State& st, States&&... /*unused*/ ) + template< typename Input > + static void apply( const Input& in, std::string& s ) { assert( !in.empty() ); // First character MUST be present, usually 'x'. - st.unescaped += unhex_string< char >( in.begin() + 1, in.end() ); + s += unhex_string< char >( in.begin() + 1, in.end() ); } }; @@ -177,12 +173,12 @@ namespace tao // (b) accepts multiple consecutive escaped 16-bit values. // When applied to more than one escape sequence, unescape_j // translates UTF-16 surrogate pairs in the input into a single - // UTF-8 sequence in st.unescaped, as required for JSON by RFC 8259. + // UTF-8 sequence in s, as required for JSON by RFC 8259. struct unescape_j { - template< typename Input, typename State, typename... States > - static void apply( const Input& in, State& st, States&&... /*unused*/ ) + template< typename Input > + static void apply( const Input& in, std::string& s ) { assert( ( ( in.size() + 1 ) % 6 ) == 0 ); // Expects multiple "\\u1234", starting with the first "u". for( const char* b = in.begin() + 1; b < in.end(); b += 6 ) { @@ -191,12 +187,11 @@ namespace tao const auto d = unhex_string< unsigned >( b + 6, b + 10 ); if( ( 0xdc00 <= d ) && ( d <= 0xdfff ) ) { b += 6; - // note: no need to check the result code, as we are always >= 0x10000 and < 0x110000. - utf8_append_utf32( st.unescaped, ( ( ( c & 0x03ff ) << 10 ) | ( d & 0x03ff ) ) + 0x10000 ); + (void)utf8_append_utf32( s, ( ( ( c & 0x03ff ) << 10 ) | ( d & 0x03ff ) ) + 0x10000 ); continue; } } - if( !utf8_append_utf32( st.unescaped, c ) ) { + if( !utf8_append_utf32( s, c ) ) { throw parse_error( "invalid escaped unicode code point", in ); } } diff --git a/thirdparty/PEGTL/include/tao/pegtl/contrib/uri.hpp b/thirdparty/PEGTL/include/tao/pegtl/contrib/uri.hpp old mode 100644 new mode 100755 index 7f51fad..c239daa --- a/thirdparty/PEGTL/include/tao/pegtl/contrib/uri.hpp +++ b/thirdparty/PEGTL/include/tao/pegtl/contrib/uri.hpp @@ -1,4 +1,4 @@ -// Copyright (c) 2014-2018 Dr. Colin Hirsch and Daniel Frey +// Copyright (c) 2014-2019 Dr. Colin Hirsch and Daniel Frey // Please see LICENSE for license or visit https://github.com/taocpp/PEGTL/ #ifndef TAO_PEGTL_CONTRIB_URI_HPP diff --git a/thirdparty/PEGTL/include/tao/pegtl/cstream_input.hpp b/thirdparty/PEGTL/include/tao/pegtl/cstream_input.hpp old mode 100644 new mode 100755 index 88c1a8e..8a9fd02 --- a/thirdparty/PEGTL/include/tao/pegtl/cstream_input.hpp +++ b/thirdparty/PEGTL/include/tao/pegtl/cstream_input.hpp @@ -1,4 +1,4 @@ -// Copyright (c) 2017-2018 Dr. Colin Hirsch and Daniel Frey +// Copyright (c) 2017-2019 Dr. Colin Hirsch and Daniel Frey // Please see LICENSE for license or visit https://github.com/taocpp/PEGTL/ #ifndef TAO_PEGTL_CSTREAM_INPUT_HPP @@ -16,13 +16,13 @@ namespace tao { namespace TAO_PEGTL_NAMESPACE { - template< typename Eol = eol::lf_crlf > + template< typename Eol = eol::lf_crlf, std::size_t Chunk = 64 > struct cstream_input - : buffer_input< internal::cstream_reader, Eol > + : buffer_input< internal::cstream_reader, Eol, std::string, Chunk > { template< typename T > cstream_input( std::FILE* in_stream, const std::size_t in_maximum, T&& in_source ) - : buffer_input< internal::cstream_reader, Eol >( std::forward< T >( in_source ), in_maximum, in_stream ) + : buffer_input< internal::cstream_reader, Eol, std::string, Chunk >( std::forward< T >( in_source ), in_maximum, in_stream ) { } }; diff --git a/thirdparty/PEGTL/include/tao/pegtl/disable_action.hpp b/thirdparty/PEGTL/include/tao/pegtl/disable_action.hpp new file mode 100755 index 0000000..e8f26bd --- /dev/null +++ b/thirdparty/PEGTL/include/tao/pegtl/disable_action.hpp @@ -0,0 +1,39 @@ +// Copyright (c) 2019 Dr. Colin Hirsch and Daniel Frey +// Please see LICENSE for license or visit https://github.com/taocpp/PEGTL/ + +#ifndef TAO_PEGTL_DISABLE_ACTION_HPP +#define TAO_PEGTL_DISABLE_ACTION_HPP + +#include "apply_mode.hpp" +#include "config.hpp" +#include "match.hpp" +#include "nothing.hpp" +#include "rewind_mode.hpp" + +namespace tao +{ + namespace TAO_PEGTL_NAMESPACE + { + struct disable_action + : maybe_nothing + { + template< typename Rule, + apply_mode A, + rewind_mode M, + template< typename... > + class Action, + template< typename... > + class Control, + typename Input, + typename... States > + static bool match( Input& in, States&&... st ) + { + return TAO_PEGTL_NAMESPACE::match< Rule, apply_mode::nothing, M, Action, Control >( in, st... ); + } + }; + + } // namespace TAO_PEGTL_NAMESPACE + +} // namespace tao + +#endif diff --git a/thirdparty/PEGTL/include/tao/pegtl/discard_input.hpp b/thirdparty/PEGTL/include/tao/pegtl/discard_input.hpp new file mode 100755 index 0000000..960f520 --- /dev/null +++ b/thirdparty/PEGTL/include/tao/pegtl/discard_input.hpp @@ -0,0 +1,41 @@ +// Copyright (c) 2019 Dr. Colin Hirsch and Daniel Frey +// Please see LICENSE for license or visit https://github.com/taocpp/PEGTL/ + +#ifndef TAO_PEGTL_DISCARD_INPUT_HPP +#define TAO_PEGTL_DISCARD_INPUT_HPP + +#include "apply_mode.hpp" +#include "config.hpp" +#include "match.hpp" +#include "nothing.hpp" +#include "rewind_mode.hpp" + +namespace tao +{ + namespace TAO_PEGTL_NAMESPACE + { + struct discard_input + : maybe_nothing + { + template< typename Rule, + apply_mode A, + rewind_mode M, + template< typename... > + class Action, + template< typename... > + class Control, + typename Input, + typename... States > + static bool match( Input& in, States&&... st ) + { + const bool result = TAO_PEGTL_NAMESPACE::match< Rule, A, M, Action, Control >( in, st... ); + in.discard(); + return result; + } + }; + + } // namespace TAO_PEGTL_NAMESPACE + +} // namespace tao + +#endif diff --git a/thirdparty/PEGTL/include/tao/pegtl/discard_input_on_failure.hpp b/thirdparty/PEGTL/include/tao/pegtl/discard_input_on_failure.hpp new file mode 100755 index 0000000..97884ad --- /dev/null +++ b/thirdparty/PEGTL/include/tao/pegtl/discard_input_on_failure.hpp @@ -0,0 +1,43 @@ +// Copyright (c) 2019 Dr. Colin Hirsch and Daniel Frey +// Please see LICENSE for license or visit https://github.com/taocpp/PEGTL/ + +#ifndef TAO_PEGTL_DISCARD_INPUT_ON_FAILURE_HPP +#define TAO_PEGTL_DISCARD_INPUT_ON_FAILURE_HPP + +#include "apply_mode.hpp" +#include "config.hpp" +#include "match.hpp" +#include "nothing.hpp" +#include "rewind_mode.hpp" + +namespace tao +{ + namespace TAO_PEGTL_NAMESPACE + { + struct discard_input_on_failure + : maybe_nothing + { + template< typename Rule, + apply_mode A, + rewind_mode M, + template< typename... > + class Action, + template< typename... > + class Control, + typename Input, + typename... States > + static bool match( Input& in, States&&... st ) + { + const bool result = TAO_PEGTL_NAMESPACE::match< Rule, A, M, Action, Control >( in, st... ); + if( !result ) { + in.discard(); + } + return result; + } + }; + + } // namespace TAO_PEGTL_NAMESPACE + +} // namespace tao + +#endif diff --git a/thirdparty/PEGTL/include/tao/pegtl/discard_input_on_success.hpp b/thirdparty/PEGTL/include/tao/pegtl/discard_input_on_success.hpp new file mode 100755 index 0000000..ed02941 --- /dev/null +++ b/thirdparty/PEGTL/include/tao/pegtl/discard_input_on_success.hpp @@ -0,0 +1,43 @@ +// Copyright (c) 2019 Dr. Colin Hirsch and Daniel Frey +// Please see LICENSE for license or visit https://github.com/taocpp/PEGTL/ + +#ifndef TAO_PEGTL_DISCARD_INPUT_ON_SUCCESS_HPP +#define TAO_PEGTL_DISCARD_INPUT_ON_SUCCESS_HPP + +#include "apply_mode.hpp" +#include "config.hpp" +#include "match.hpp" +#include "nothing.hpp" +#include "rewind_mode.hpp" + +namespace tao +{ + namespace TAO_PEGTL_NAMESPACE + { + struct discard_input_on_success + : maybe_nothing + { + template< typename Rule, + apply_mode A, + rewind_mode M, + template< typename... > + class Action, + template< typename... > + class Control, + typename Input, + typename... States > + static bool match( Input& in, States&&... st ) + { + const bool result = TAO_PEGTL_NAMESPACE::match< Rule, A, M, Action, Control >( in, st... ); + if( result ) { + in.discard(); + } + return result; + } + }; + + } // namespace TAO_PEGTL_NAMESPACE + +} // namespace tao + +#endif diff --git a/thirdparty/PEGTL/include/tao/pegtl/enable_action.hpp b/thirdparty/PEGTL/include/tao/pegtl/enable_action.hpp new file mode 100755 index 0000000..9679259 --- /dev/null +++ b/thirdparty/PEGTL/include/tao/pegtl/enable_action.hpp @@ -0,0 +1,39 @@ +// Copyright (c) 2019 Dr. Colin Hirsch and Daniel Frey +// Please see LICENSE for license or visit https://github.com/taocpp/PEGTL/ + +#ifndef TAO_PEGTL_ENABLE_ACTION_HPP +#define TAO_PEGTL_ENABLE_ACTION_HPP + +#include "apply_mode.hpp" +#include "config.hpp" +#include "match.hpp" +#include "nothing.hpp" +#include "rewind_mode.hpp" + +namespace tao +{ + namespace TAO_PEGTL_NAMESPACE + { + struct enable_action + : maybe_nothing + { + template< typename Rule, + apply_mode A, + rewind_mode M, + template< typename... > + class Action, + template< typename... > + class Control, + typename Input, + typename... States > + static bool match( Input& in, States&&... st ) + { + return TAO_PEGTL_NAMESPACE::match< Rule, apply_mode::action, M, Action, Control >( in, st... ); + } + }; + + } // namespace TAO_PEGTL_NAMESPACE + +} // namespace tao + +#endif diff --git a/thirdparty/PEGTL/include/tao/pegtl/eol.hpp b/thirdparty/PEGTL/include/tao/pegtl/eol.hpp old mode 100644 new mode 100755 index 29a8a89..2c9b6dc --- a/thirdparty/PEGTL/include/tao/pegtl/eol.hpp +++ b/thirdparty/PEGTL/include/tao/pegtl/eol.hpp @@ -1,4 +1,4 @@ -// Copyright (c) 2016-2018 Dr. Colin Hirsch and Daniel Frey +// Copyright (c) 2016-2019 Dr. Colin Hirsch and Daniel Frey // Please see LICENSE for license or visit https://github.com/taocpp/PEGTL/ #ifndef TAO_PEGTL_EOL_HPP diff --git a/thirdparty/PEGTL/include/tao/pegtl/eol_pair.hpp b/thirdparty/PEGTL/include/tao/pegtl/eol_pair.hpp old mode 100644 new mode 100755 index 384bea1..581e90b --- a/thirdparty/PEGTL/include/tao/pegtl/eol_pair.hpp +++ b/thirdparty/PEGTL/include/tao/pegtl/eol_pair.hpp @@ -1,4 +1,4 @@ -// Copyright (c) 2017-2018 Dr. Colin Hirsch and Daniel Frey +// Copyright (c) 2017-2019 Dr. Colin Hirsch and Daniel Frey // Please see LICENSE for license or visit https://github.com/taocpp/PEGTL/ #ifndef TAO_PEGTL_EOL_PAIR_HPP diff --git a/thirdparty/PEGTL/include/tao/pegtl/file_input.hpp b/thirdparty/PEGTL/include/tao/pegtl/file_input.hpp old mode 100644 new mode 100755 index 1959a09..5d0bf1b --- a/thirdparty/PEGTL/include/tao/pegtl/file_input.hpp +++ b/thirdparty/PEGTL/include/tao/pegtl/file_input.hpp @@ -1,4 +1,4 @@ -// Copyright (c) 2015-2018 Dr. Colin Hirsch and Daniel Frey +// Copyright (c) 2015-2019 Dr. Colin Hirsch and Daniel Frey // Please see LICENSE for license or visit https://github.com/taocpp/PEGTL/ #ifndef TAO_PEGTL_FILE_INPUT_HPP @@ -23,14 +23,14 @@ namespace tao namespace TAO_PEGTL_NAMESPACE { #if defined( _POSIX_MAPPED_FILES ) || defined( _WIN32 ) - template< tracking_mode P = tracking_mode::IMMEDIATE, typename Eol = eol::lf_crlf > + template< tracking_mode P = tracking_mode::eager, typename Eol = eol::lf_crlf > struct file_input : mmap_input< P, Eol > { using mmap_input< P, Eol >::mmap_input; }; #else - template< tracking_mode P = tracking_mode::IMMEDIATE, typename Eol = eol::lf_crlf > + template< tracking_mode P = tracking_mode::eager, typename Eol = eol::lf_crlf > struct file_input : read_input< P, Eol > { diff --git a/thirdparty/PEGTL/include/tao/pegtl/input_error.hpp b/thirdparty/PEGTL/include/tao/pegtl/input_error.hpp old mode 100644 new mode 100755 index eb302c9..4c7aec5 --- a/thirdparty/PEGTL/include/tao/pegtl/input_error.hpp +++ b/thirdparty/PEGTL/include/tao/pegtl/input_error.hpp @@ -1,4 +1,4 @@ -// Copyright (c) 2014-2018 Dr. Colin Hirsch and Daniel Frey +// Copyright (c) 2014-2019 Dr. Colin Hirsch and Daniel Frey // Please see LICENSE for license or visit https://github.com/taocpp/PEGTL/ #ifndef TAO_PEGTL_INPUT_ERROR_HPP diff --git a/thirdparty/PEGTL/include/tao/pegtl/internal/action.hpp b/thirdparty/PEGTL/include/tao/pegtl/internal/action.hpp old mode 100644 new mode 100755 index b7a4f6a..8baf628 --- a/thirdparty/PEGTL/include/tao/pegtl/internal/action.hpp +++ b/thirdparty/PEGTL/include/tao/pegtl/internal/action.hpp @@ -1,4 +1,4 @@ -// Copyright (c) 2014-2018 Dr. Colin Hirsch and Daniel Frey +// Copyright (c) 2014-2019 Dr. Colin Hirsch and Daniel Frey // Please see LICENSE for license or visit https://github.com/taocpp/PEGTL/ #ifndef TAO_PEGTL_INTERNAL_ACTION_HPP @@ -24,12 +24,14 @@ namespace tao template< template< typename... > class Action, typename... Rules > struct action { - using analyze_t = analysis::generic< analysis::rule_type::SEQ, Rules... >; + using analyze_t = analysis::generic< analysis::rule_type::seq, Rules... >; template< apply_mode A, rewind_mode M, - template< typename... > class, - template< typename... > class Control, + template< typename... > + class, + template< typename... > + class Control, typename Input, typename... States > static bool match( Input& in, States&&... st ) diff --git a/thirdparty/PEGTL/include/tao/pegtl/internal/action_input.hpp b/thirdparty/PEGTL/include/tao/pegtl/internal/action_input.hpp old mode 100644 new mode 100755 index ec15ea1..7f45cc4 --- a/thirdparty/PEGTL/include/tao/pegtl/internal/action_input.hpp +++ b/thirdparty/PEGTL/include/tao/pegtl/internal/action_input.hpp @@ -1,4 +1,4 @@ -// Copyright (c) 2016-2018 Dr. Colin Hirsch and Daniel Frey +// Copyright (c) 2016-2019 Dr. Colin Hirsch and Daniel Frey // Please see LICENSE for license or visit https://github.com/taocpp/PEGTL/ #ifndef TAO_PEGTL_INTERNAL_ACTION_INPUT_HPP @@ -90,6 +90,12 @@ namespace tao return begin()[ offset ]; } + std::uint8_t peek_uint8( const std::size_t offset = 0 ) const noexcept + { + return static_cast< std::uint8_t >( peek_char( offset ) ); + } + + // Compatibility, remove with 3.0.0 std::uint8_t peek_byte( const std::size_t offset = 0 ) const noexcept { return static_cast< std::uint8_t >( peek_char( offset ) ); @@ -97,7 +103,7 @@ namespace tao TAO_PEGTL_NAMESPACE::position position() const { - return input().position( iterator() ); // NOTE: Not efficient with LAZY inputs. + return input().position( iterator() ); // NOTE: Not efficient with lazy inputs. } protected: diff --git a/thirdparty/PEGTL/include/tao/pegtl/internal/alnum.hpp b/thirdparty/PEGTL/include/tao/pegtl/internal/alnum.hpp old mode 100644 new mode 100755 index f42fa1a..3b2eeb7 --- a/thirdparty/PEGTL/include/tao/pegtl/internal/alnum.hpp +++ b/thirdparty/PEGTL/include/tao/pegtl/internal/alnum.hpp @@ -1,4 +1,4 @@ -// Copyright (c) 2017-2018 Dr. Colin Hirsch and Daniel Frey +// Copyright (c) 2017-2019 Dr. Colin Hirsch and Daniel Frey // Please see LICENSE for license or visit https://github.com/taocpp/PEGTL/ #ifndef TAO_PEGTL_INTERNAL_ALNUM_HPP diff --git a/thirdparty/PEGTL/include/tao/pegtl/internal/alpha.hpp b/thirdparty/PEGTL/include/tao/pegtl/internal/alpha.hpp old mode 100644 new mode 100755 index b55d1ed..5203c5a --- a/thirdparty/PEGTL/include/tao/pegtl/internal/alpha.hpp +++ b/thirdparty/PEGTL/include/tao/pegtl/internal/alpha.hpp @@ -1,4 +1,4 @@ -// Copyright (c) 2017-2018 Dr. Colin Hirsch and Daniel Frey +// Copyright (c) 2017-2019 Dr. Colin Hirsch and Daniel Frey // Please see LICENSE for license or visit https://github.com/taocpp/PEGTL/ #ifndef TAO_PEGTL_INTERNAL_ALPHA_HPP diff --git a/thirdparty/PEGTL/include/tao/pegtl/internal/always_false.hpp b/thirdparty/PEGTL/include/tao/pegtl/internal/always_false.hpp new file mode 100755 index 0000000..1d0b8f4 --- /dev/null +++ b/thirdparty/PEGTL/include/tao/pegtl/internal/always_false.hpp @@ -0,0 +1,29 @@ +// Copyright (c) 2018-2019 Dr. Colin Hirsch and Daniel Frey +// Please see LICENSE for license or visit https://github.com/taocpp/PEGTL/ + +#ifndef TAO_PEGTL_INTERNAL_ALWAYS_FALSE_HPP +#define TAO_PEGTL_INTERNAL_ALWAYS_FALSE_HPP + +#include "../config.hpp" + +#include + +namespace tao +{ + namespace TAO_PEGTL_NAMESPACE + { + namespace internal + { + template< typename... > + struct always_false + : std::false_type + { + }; + + } // namespace internal + + } // namespace TAO_PEGTL_NAMESPACE + +} // namespace tao + +#endif diff --git a/thirdparty/PEGTL/include/tao/pegtl/internal/any.hpp b/thirdparty/PEGTL/include/tao/pegtl/internal/any.hpp old mode 100644 new mode 100755 index 4c962d7..6c3d218 --- a/thirdparty/PEGTL/include/tao/pegtl/internal/any.hpp +++ b/thirdparty/PEGTL/include/tao/pegtl/internal/any.hpp @@ -1,4 +1,4 @@ -// Copyright (c) 2014-2018 Dr. Colin Hirsch and Daniel Frey +// Copyright (c) 2014-2019 Dr. Colin Hirsch and Daniel Frey // Please see LICENSE for license or visit https://github.com/taocpp/PEGTL/ #ifndef TAO_PEGTL_INTERNAL_ANY_HPP @@ -23,7 +23,7 @@ namespace tao template<> struct any< peek_char > { - using analyze_t = analysis::generic< analysis::rule_type::ANY >; + using analyze_t = analysis::generic< analysis::rule_type::any >; template< typename Input > static bool match( Input& in ) noexcept( noexcept( in.empty() ) ) @@ -39,13 +39,14 @@ namespace tao template< typename Peek > struct any { - using analyze_t = analysis::generic< analysis::rule_type::ANY >; + using analyze_t = analysis::generic< analysis::rule_type::any >; template< typename Input > - static bool match( Input& in ) noexcept( noexcept( in.empty() ) ) + static bool match( Input& in ) noexcept( noexcept( in.size( Peek::max_input_size ) ) ) { - if( !in.empty() ) { - if( const auto t = Peek::peek( in ) ) { + const std::size_t s = in.size( Peek::max_input_size ); + if( s >= Peek::min_input_size ) { + if( const auto t = Peek::peek( in, s ) ) { in.bump( t.size ); return true; } diff --git a/thirdparty/PEGTL/include/tao/pegtl/internal/apply.hpp b/thirdparty/PEGTL/include/tao/pegtl/internal/apply.hpp old mode 100644 new mode 100755 index 7954f2f..51e1084 --- a/thirdparty/PEGTL/include/tao/pegtl/internal/apply.hpp +++ b/thirdparty/PEGTL/include/tao/pegtl/internal/apply.hpp @@ -1,4 +1,4 @@ -// Copyright (c) 2017-2018 Dr. Colin Hirsch and Daniel Frey +// Copyright (c) 2017-2019 Dr. Colin Hirsch and Daniel Frey // Please see LICENSE for license or visit https://github.com/taocpp/PEGTL/ #ifndef TAO_PEGTL_INTERNAL_APPLY_HPP @@ -23,7 +23,7 @@ namespace tao struct apply_impl; template<> - struct apply_impl< apply_mode::ACTION > + struct apply_impl< apply_mode::action > { template< typename Input, typename... States > static bool match( Input& /*unused*/, States&&... /*unused*/ ) @@ -33,7 +33,7 @@ namespace tao }; template< typename... Actions > - struct apply_impl< apply_mode::ACTION, Actions... > + struct apply_impl< apply_mode::action, Actions... > { template< typename Input, typename... States > static bool match( Input& in, States&&... st ) @@ -52,7 +52,7 @@ namespace tao }; template< typename... Actions > - struct apply_impl< apply_mode::NOTHING, Actions... > + struct apply_impl< apply_mode::nothing, Actions... > { template< typename Input, typename... States > static bool match( Input& /*unused*/, States&&... /*unused*/ ) @@ -64,12 +64,14 @@ namespace tao template< typename... Actions > struct apply { - using analyze_t = analysis::counted< analysis::rule_type::ANY, 0 >; + using analyze_t = analysis::counted< analysis::rule_type::any, 0 >; template< apply_mode A, rewind_mode M, - template< typename... > class Action, - template< typename... > class Control, + template< typename... > + class Action, + template< typename... > + class Control, typename Input, typename... States > static bool match( Input& in, States&&... st ) diff --git a/thirdparty/PEGTL/include/tao/pegtl/internal/apply0.hpp b/thirdparty/PEGTL/include/tao/pegtl/internal/apply0.hpp old mode 100644 new mode 100755 index 5a13f6d..6bade49 --- a/thirdparty/PEGTL/include/tao/pegtl/internal/apply0.hpp +++ b/thirdparty/PEGTL/include/tao/pegtl/internal/apply0.hpp @@ -1,4 +1,4 @@ -// Copyright (c) 2017-2018 Dr. Colin Hirsch and Daniel Frey +// Copyright (c) 2017-2019 Dr. Colin Hirsch and Daniel Frey // Please see LICENSE for license or visit https://github.com/taocpp/PEGTL/ #ifndef TAO_PEGTL_INTERNAL_APPLY0_HPP @@ -23,7 +23,7 @@ namespace tao struct apply0_impl; template<> - struct apply0_impl< apply_mode::ACTION > + struct apply0_impl< apply_mode::action > { template< typename... States > static bool match( States&&... /*unused*/ ) noexcept @@ -33,7 +33,7 @@ namespace tao }; template< typename... Actions > - struct apply0_impl< apply_mode::ACTION, Actions... > + struct apply0_impl< apply_mode::action, Actions... > { template< typename... States > static bool match( States&&... st ) @@ -50,7 +50,7 @@ namespace tao }; template< typename... Actions > - struct apply0_impl< apply_mode::NOTHING, Actions... > + struct apply0_impl< apply_mode::nothing, Actions... > { template< typename... States > static bool match( States&&... /*unused*/ ) noexcept @@ -62,12 +62,14 @@ namespace tao template< typename... Actions > struct apply0 { - using analyze_t = analysis::counted< analysis::rule_type::ANY, 0 >; + using analyze_t = analysis::counted< analysis::rule_type::any, 0 >; template< apply_mode A, rewind_mode M, - template< typename... > class Action, - template< typename... > class Control, + template< typename... > + class Action, + template< typename... > + class Control, typename Input, typename... States > static bool match( Input& /*unused*/, States&&... st ) diff --git a/thirdparty/PEGTL/include/tao/pegtl/internal/apply0_single.hpp b/thirdparty/PEGTL/include/tao/pegtl/internal/apply0_single.hpp old mode 100644 new mode 100755 index 06bae4f..c419f33 --- a/thirdparty/PEGTL/include/tao/pegtl/internal/apply0_single.hpp +++ b/thirdparty/PEGTL/include/tao/pegtl/internal/apply0_single.hpp @@ -1,4 +1,4 @@ -// Copyright (c) 2017-2018 Dr. Colin Hirsch and Daniel Frey +// Copyright (c) 2017-2019 Dr. Colin Hirsch and Daniel Frey // Please see LICENSE for license or visit https://github.com/taocpp/PEGTL/ #ifndef TAO_PEGTL_INTERNAL_APPLY0_SINGLE_HPP diff --git a/thirdparty/PEGTL/include/tao/pegtl/internal/apply_single.hpp b/thirdparty/PEGTL/include/tao/pegtl/internal/apply_single.hpp old mode 100644 new mode 100755 index 9907234..8ed96dd --- a/thirdparty/PEGTL/include/tao/pegtl/internal/apply_single.hpp +++ b/thirdparty/PEGTL/include/tao/pegtl/internal/apply_single.hpp @@ -1,4 +1,4 @@ -// Copyright (c) 2017-2018 Dr. Colin Hirsch and Daniel Frey +// Copyright (c) 2017-2019 Dr. Colin Hirsch and Daniel Frey // Please see LICENSE for license or visit https://github.com/taocpp/PEGTL/ #ifndef TAO_PEGTL_INTERNAL_APPLY_SINGLE_HPP diff --git a/thirdparty/PEGTL/include/tao/pegtl/internal/at.hpp b/thirdparty/PEGTL/include/tao/pegtl/internal/at.hpp old mode 100644 new mode 100755 index b4997c9..2f362ba --- a/thirdparty/PEGTL/include/tao/pegtl/internal/at.hpp +++ b/thirdparty/PEGTL/include/tao/pegtl/internal/at.hpp @@ -1,4 +1,4 @@ -// Copyright (c) 2014-2018 Dr. Colin Hirsch and Daniel Frey +// Copyright (c) 2014-2019 Dr. Colin Hirsch and Daniel Frey // Please see LICENSE for license or visit https://github.com/taocpp/PEGTL/ #ifndef TAO_PEGTL_INTERNAL_AT_HPP @@ -33,18 +33,20 @@ namespace tao template< typename... Rules > struct at { - using analyze_t = analysis::generic< analysis::rule_type::OPT, Rules... >; + using analyze_t = analysis::generic< analysis::rule_type::opt, Rules... >; template< apply_mode, rewind_mode, - template< typename... > class Action, - template< typename... > class Control, + template< typename... > + class Action, + template< typename... > + class Control, typename Input, typename... States > static bool match( Input& in, States&&... st ) { - const auto m = in.template mark< rewind_mode::REQUIRED >(); - return rule_conjunction< Rules... >::template match< apply_mode::NOTHING, rewind_mode::ACTIVE, Action, Control >( in, st... ); + const auto m = in.template mark< rewind_mode::required >(); + return rule_conjunction< Rules... >::template match< apply_mode::nothing, rewind_mode::active, Action, Control >( in, st... ); } }; diff --git a/thirdparty/PEGTL/include/tao/pegtl/internal/bof.hpp b/thirdparty/PEGTL/include/tao/pegtl/internal/bof.hpp old mode 100644 new mode 100755 index b6c9c21..5d492bf --- a/thirdparty/PEGTL/include/tao/pegtl/internal/bof.hpp +++ b/thirdparty/PEGTL/include/tao/pegtl/internal/bof.hpp @@ -1,4 +1,4 @@ -// Copyright (c) 2017-2018 Dr. Colin Hirsch and Daniel Frey +// Copyright (c) 2017-2019 Dr. Colin Hirsch and Daniel Frey // Please see LICENSE for license or visit https://github.com/taocpp/PEGTL/ #ifndef TAO_PEGTL_INTERNAL_BOF_HPP @@ -18,7 +18,7 @@ namespace tao { struct bof { - using analyze_t = analysis::generic< analysis::rule_type::OPT >; + using analyze_t = analysis::generic< analysis::rule_type::opt >; template< typename Input > static bool match( Input& in ) noexcept diff --git a/thirdparty/PEGTL/include/tao/pegtl/internal/bol.hpp b/thirdparty/PEGTL/include/tao/pegtl/internal/bol.hpp old mode 100644 new mode 100755 index dda3179..ac407d9 --- a/thirdparty/PEGTL/include/tao/pegtl/internal/bol.hpp +++ b/thirdparty/PEGTL/include/tao/pegtl/internal/bol.hpp @@ -1,4 +1,4 @@ -// Copyright (c) 2017-2018 Dr. Colin Hirsch and Daniel Frey +// Copyright (c) 2017-2019 Dr. Colin Hirsch and Daniel Frey // Please see LICENSE for license or visit https://github.com/taocpp/PEGTL/ #ifndef TAO_PEGTL_INTERNAL_BOL_HPP @@ -18,7 +18,7 @@ namespace tao { struct bol { - using analyze_t = analysis::generic< analysis::rule_type::OPT >; + using analyze_t = analysis::generic< analysis::rule_type::opt >; template< typename Input > static bool match( Input& in ) noexcept diff --git a/thirdparty/PEGTL/include/tao/pegtl/internal/bump_impl.hpp b/thirdparty/PEGTL/include/tao/pegtl/internal/bump.hpp old mode 100644 new mode 100755 similarity index 89% rename from thirdparty/PEGTL/include/tao/pegtl/internal/bump_impl.hpp rename to thirdparty/PEGTL/include/tao/pegtl/internal/bump.hpp index ffd904d..42d49ac --- a/thirdparty/PEGTL/include/tao/pegtl/internal/bump_impl.hpp +++ b/thirdparty/PEGTL/include/tao/pegtl/internal/bump.hpp @@ -1,8 +1,8 @@ -// Copyright (c) 2017-2018 Dr. Colin Hirsch and Daniel Frey +// Copyright (c) 2017-2019 Dr. Colin Hirsch and Daniel Frey // Please see LICENSE for license or visit https://github.com/taocpp/PEGTL/ -#ifndef TAO_PEGTL_INTERNAL_BUMP_IMPL_HPP -#define TAO_PEGTL_INTERNAL_BUMP_IMPL_HPP +#ifndef TAO_PEGTL_INTERNAL_BUMP_HPP +#define TAO_PEGTL_INTERNAL_BUMP_HPP #include "../config.hpp" diff --git a/thirdparty/PEGTL/include/tao/pegtl/internal/bump_help.hpp b/thirdparty/PEGTL/include/tao/pegtl/internal/bump_help.hpp old mode 100644 new mode 100755 index b09f2ed..4a7998b --- a/thirdparty/PEGTL/include/tao/pegtl/internal/bump_help.hpp +++ b/thirdparty/PEGTL/include/tao/pegtl/internal/bump_help.hpp @@ -1,4 +1,4 @@ -// Copyright (c) 2015-2018 Dr. Colin Hirsch and Daniel Frey +// Copyright (c) 2015-2019 Dr. Colin Hirsch and Daniel Frey // Please see LICENSE for license or visit https://github.com/taocpp/PEGTL/ #ifndef TAO_PEGTL_INTERNAL_BUMP_HELP_HPP diff --git a/thirdparty/PEGTL/include/tao/pegtl/internal/bytes.hpp b/thirdparty/PEGTL/include/tao/pegtl/internal/bytes.hpp old mode 100644 new mode 100755 index 789224c..e4da380 --- a/thirdparty/PEGTL/include/tao/pegtl/internal/bytes.hpp +++ b/thirdparty/PEGTL/include/tao/pegtl/internal/bytes.hpp @@ -1,4 +1,4 @@ -// Copyright (c) 2014-2018 Dr. Colin Hirsch and Daniel Frey +// Copyright (c) 2014-2019 Dr. Colin Hirsch and Daniel Frey // Please see LICENSE for license or visit https://github.com/taocpp/PEGTL/ #ifndef TAO_PEGTL_INTERNAL_BYTES_HPP @@ -19,7 +19,7 @@ namespace tao template< unsigned Num > struct bytes { - using analyze_t = analysis::counted< analysis::rule_type::ANY, Num >; + using analyze_t = analysis::counted< analysis::rule_type::any, Num >; template< typename Input > static bool match( Input& in ) noexcept( noexcept( in.size( 0 ) ) ) diff --git a/thirdparty/PEGTL/include/tao/pegtl/internal/conditional.hpp b/thirdparty/PEGTL/include/tao/pegtl/internal/conditional.hpp deleted file mode 100644 index dbf356d..0000000 --- a/thirdparty/PEGTL/include/tao/pegtl/internal/conditional.hpp +++ /dev/null @@ -1,38 +0,0 @@ -// Copyright (c) 2018 Dr. Colin Hirsch and Daniel Frey -// Please see LICENSE for license or visit https://github.com/taocpp/PEGTL/ - -#ifndef TAO_PEGTL_INTERNAL_CONDITIONAL_HPP -#define TAO_PEGTL_INTERNAL_CONDITIONAL_HPP - -#include "../config.hpp" - -namespace tao -{ - namespace TAO_PEGTL_NAMESPACE - { - namespace internal - { - template< bool > - struct conditional; - - template<> - struct conditional< true > - { - template< typename T, typename > - using type = T; - }; - - template<> - struct conditional< false > - { - template< typename, typename T > - using type = T; - }; - - } // namespace internal - - } // namespace TAO_PEGTL_NAMESPACE - -} // namespace tao - -#endif diff --git a/thirdparty/PEGTL/include/tao/pegtl/internal/control.hpp b/thirdparty/PEGTL/include/tao/pegtl/internal/control.hpp old mode 100644 new mode 100755 index 88cc5a1..aec939f --- a/thirdparty/PEGTL/include/tao/pegtl/internal/control.hpp +++ b/thirdparty/PEGTL/include/tao/pegtl/internal/control.hpp @@ -1,4 +1,4 @@ -// Copyright (c) 2014-2018 Dr. Colin Hirsch and Daniel Frey +// Copyright (c) 2014-2019 Dr. Colin Hirsch and Daniel Frey // Please see LICENSE for license or visit https://github.com/taocpp/PEGTL/ #ifndef TAO_PEGTL_INTERNAL_CONTROL_HPP @@ -24,12 +24,14 @@ namespace tao template< template< typename... > class Control, typename... Rules > struct control { - using analyze_t = analysis::generic< analysis::rule_type::SEQ, Rules... >; + using analyze_t = analysis::generic< analysis::rule_type::seq, Rules... >; template< apply_mode A, rewind_mode M, - template< typename... > class Action, - template< typename... > class, + template< typename... > + class Action, + template< typename... > + class, typename Input, typename... States > static bool match( Input& in, States&&... st ) diff --git a/thirdparty/PEGTL/include/tao/pegtl/internal/cr_crlf_eol.hpp b/thirdparty/PEGTL/include/tao/pegtl/internal/cr_crlf_eol.hpp old mode 100644 new mode 100755 index 8b83e24..6e3e2a7 --- a/thirdparty/PEGTL/include/tao/pegtl/internal/cr_crlf_eol.hpp +++ b/thirdparty/PEGTL/include/tao/pegtl/internal/cr_crlf_eol.hpp @@ -1,4 +1,4 @@ -// Copyright (c) 2016-2018 Dr. Colin Hirsch and Daniel Frey +// Copyright (c) 2016-2019 Dr. Colin Hirsch and Daniel Frey // Please see LICENSE for license or visit https://github.com/taocpp/PEGTL/ #ifndef TAO_PEGTL_INTERNAL_CR_CRLF_EOL_HPP diff --git a/thirdparty/PEGTL/include/tao/pegtl/internal/cr_eol.hpp b/thirdparty/PEGTL/include/tao/pegtl/internal/cr_eol.hpp old mode 100644 new mode 100755 index ad2bb5e..b3aff95 --- a/thirdparty/PEGTL/include/tao/pegtl/internal/cr_eol.hpp +++ b/thirdparty/PEGTL/include/tao/pegtl/internal/cr_eol.hpp @@ -1,4 +1,4 @@ -// Copyright (c) 2016-2018 Dr. Colin Hirsch and Daniel Frey +// Copyright (c) 2016-2019 Dr. Colin Hirsch and Daniel Frey // Please see LICENSE for license or visit https://github.com/taocpp/PEGTL/ #ifndef TAO_PEGTL_INTERNAL_CR_EOL_HPP diff --git a/thirdparty/PEGTL/include/tao/pegtl/internal/crlf_eol.hpp b/thirdparty/PEGTL/include/tao/pegtl/internal/crlf_eol.hpp old mode 100644 new mode 100755 index 308eca9..84c97b3 --- a/thirdparty/PEGTL/include/tao/pegtl/internal/crlf_eol.hpp +++ b/thirdparty/PEGTL/include/tao/pegtl/internal/crlf_eol.hpp @@ -1,4 +1,4 @@ -// Copyright (c) 2016-2018 Dr. Colin Hirsch and Daniel Frey +// Copyright (c) 2016-2019 Dr. Colin Hirsch and Daniel Frey // Please see LICENSE for license or visit https://github.com/taocpp/PEGTL/ #ifndef TAO_PEGTL_INTERNAL_CRLF_EOL_HPP diff --git a/thirdparty/PEGTL/include/tao/pegtl/internal/cstream_reader.hpp b/thirdparty/PEGTL/include/tao/pegtl/internal/cstream_reader.hpp old mode 100644 new mode 100755 index 756bc54..0769e67 --- a/thirdparty/PEGTL/include/tao/pegtl/internal/cstream_reader.hpp +++ b/thirdparty/PEGTL/include/tao/pegtl/internal/cstream_reader.hpp @@ -1,4 +1,4 @@ -// Copyright (c) 2016-2018 Dr. Colin Hirsch and Daniel Frey +// Copyright (c) 2016-2019 Dr. Colin Hirsch and Daniel Frey // Please see LICENSE for license or visit https://github.com/taocpp/PEGTL/ #ifndef TAO_PEGTL_INTERNAL_CSTREAM_READER_HPP diff --git a/thirdparty/PEGTL/include/tao/pegtl/internal/cstring_reader.hpp b/thirdparty/PEGTL/include/tao/pegtl/internal/cstring_reader.hpp old mode 100644 new mode 100755 index e745921..935b794 --- a/thirdparty/PEGTL/include/tao/pegtl/internal/cstring_reader.hpp +++ b/thirdparty/PEGTL/include/tao/pegtl/internal/cstring_reader.hpp @@ -1,4 +1,4 @@ -// Copyright (c) 2016-2018 Dr. Colin Hirsch and Daniel Frey +// Copyright (c) 2016-2019 Dr. Colin Hirsch and Daniel Frey // Please see LICENSE for license or visit https://github.com/taocpp/PEGTL/ #ifndef TAO_PEGTL_INTERNAL_CSTRING_READER_HPP diff --git a/thirdparty/PEGTL/include/tao/pegtl/internal/demangle.hpp b/thirdparty/PEGTL/include/tao/pegtl/internal/demangle.hpp old mode 100644 new mode 100755 index 9795f71..75c4e61 --- a/thirdparty/PEGTL/include/tao/pegtl/internal/demangle.hpp +++ b/thirdparty/PEGTL/include/tao/pegtl/internal/demangle.hpp @@ -1,4 +1,4 @@ -// Copyright (c) 2014-2018 Dr. Colin Hirsch and Daniel Frey +// Copyright (c) 2014-2019 Dr. Colin Hirsch and Daniel Frey // Please see LICENSE for license or visit https://github.com/taocpp/PEGTL/ #ifndef TAO_PEGTL_INTERNAL_DEMANGLE_HPP @@ -9,14 +9,40 @@ #include "../config.hpp" +#if defined( __clang__ ) +#if __has_feature( cxx_rtti ) +#define TAO_PEGTL_RTTI_ENABLED +#endif +#elif defined( __GNUC__ ) +#if defined( __GXX_RTTI ) +#define TAO_PEGTL_RTTI_ENABLED +#endif +#elif defined( _MSC_VER ) +#if defined( _CPPRTTI ) +#define TAO_PEGTL_RTTI_ENABLED +#endif +#else +#define TAO_PEGTL_RTTI_ENABLED +#endif + +#if !defined( TAO_PEGTL_RTTI_ENABLED ) +#include +#include +#endif + +#if defined( TAO_PEGTL_RTTI_ENABLED ) #if defined( __GLIBCXX__ ) -#include "demangle_cxxabi.hpp" +#define TAO_PEGTL_USE_CXXABI_DEMANGLE #elif defined( __has_include ) #if __has_include( ) -#include "demangle_cxxabi.hpp" -#else -#include "demangle_nop.hpp" +#define TAO_PEGTL_USE_CXXABI_DEMANGLE +#endif #endif +#endif + +#if defined( TAO_PEGTL_USE_CXXABI_DEMANGLE ) +#include "demangle_cxxabi.hpp" +#undef TAO_PEGTL_USE_CXXABI_DEMANGLE #else #include "demangle_nop.hpp" #endif @@ -30,7 +56,24 @@ namespace tao template< typename T > std::string demangle() { +#if defined( TAO_PEGTL_RTTI_ENABLED ) return demangle( typeid( T ).name() ); +#else + const char* start = nullptr; + const char* stop = nullptr; +#if defined( __clang__ ) || defined( __GNUC__ ) + start = std::strchr( __PRETTY_FUNCTION__, '=' ) + 2; + stop = std::strrchr( start, ';' ); +#elif defined( _MSC_VER ) + start = std::strstr( __FUNCSIG__, "demangle<" ) + ( sizeof( "demangle<" ) - 1 ); + stop = std::strrchr( start, '>' ); +#else + static_assert( false, "expected to use rtti with this compiler" ); +#endif + assert( start != nullptr ); + assert( stop != nullptr ); + return { start, std::size_t( stop - start ) }; +#endif } } // namespace internal diff --git a/thirdparty/PEGTL/include/tao/pegtl/internal/demangle_cxxabi.hpp b/thirdparty/PEGTL/include/tao/pegtl/internal/demangle_cxxabi.hpp old mode 100644 new mode 100755 index e5ecbf9..8351c44 --- a/thirdparty/PEGTL/include/tao/pegtl/internal/demangle_cxxabi.hpp +++ b/thirdparty/PEGTL/include/tao/pegtl/internal/demangle_cxxabi.hpp @@ -1,4 +1,4 @@ -// Copyright (c) 2014-2018 Dr. Colin Hirsch and Daniel Frey +// Copyright (c) 2014-2019 Dr. Colin Hirsch and Daniel Frey // Please see LICENSE for license or visit https://github.com/taocpp/PEGTL/ #ifndef TAO_PEGTL_INTERNAL_DEMANGLE_CXXABI_HPP diff --git a/thirdparty/PEGTL/include/tao/pegtl/internal/demangle_nop.hpp b/thirdparty/PEGTL/include/tao/pegtl/internal/demangle_nop.hpp old mode 100644 new mode 100755 index fe72b88..3dd8cba --- a/thirdparty/PEGTL/include/tao/pegtl/internal/demangle_nop.hpp +++ b/thirdparty/PEGTL/include/tao/pegtl/internal/demangle_nop.hpp @@ -1,4 +1,4 @@ -// Copyright (c) 2014-2018 Dr. Colin Hirsch and Daniel Frey +// Copyright (c) 2014-2019 Dr. Colin Hirsch and Daniel Frey // Please see LICENSE for license or visit https://github.com/taocpp/PEGTL/ #ifndef TAO_PEGTL_INTERNAL_DEMANGLE_NOP_HPP diff --git a/thirdparty/PEGTL/include/tao/pegtl/internal/demangle_sanitise.hpp b/thirdparty/PEGTL/include/tao/pegtl/internal/demangle_sanitise.hpp old mode 100644 new mode 100755 index 7dfb599..7e45d08 --- a/thirdparty/PEGTL/include/tao/pegtl/internal/demangle_sanitise.hpp +++ b/thirdparty/PEGTL/include/tao/pegtl/internal/demangle_sanitise.hpp @@ -1,4 +1,4 @@ -// Copyright (c) 2017-2018 Dr. Colin Hirsch and Daniel Frey +// Copyright (c) 2017-2019 Dr. Colin Hirsch and Daniel Frey // Please see LICENSE for license or visit https://github.com/taocpp/PEGTL/ #ifndef TAO_PEGTL_INTERNAL_DEMANGLE_SANITISE_HPP diff --git a/thirdparty/PEGTL/include/tao/pegtl/internal/disable.hpp b/thirdparty/PEGTL/include/tao/pegtl/internal/disable.hpp old mode 100644 new mode 100755 index 90ae99b..8d10ff8 --- a/thirdparty/PEGTL/include/tao/pegtl/internal/disable.hpp +++ b/thirdparty/PEGTL/include/tao/pegtl/internal/disable.hpp @@ -1,4 +1,4 @@ -// Copyright (c) 2014-2018 Dr. Colin Hirsch and Daniel Frey +// Copyright (c) 2014-2019 Dr. Colin Hirsch and Daniel Frey // Please see LICENSE for license or visit https://github.com/taocpp/PEGTL/ #ifndef TAO_PEGTL_INTERNAL_DISABLE_HPP @@ -24,17 +24,19 @@ namespace tao template< typename... Rules > struct disable { - using analyze_t = analysis::generic< analysis::rule_type::SEQ, Rules... >; + using analyze_t = analysis::generic< analysis::rule_type::seq, Rules... >; template< apply_mode, rewind_mode M, - template< typename... > class Action, - template< typename... > class Control, + template< typename... > + class Action, + template< typename... > + class Control, typename Input, typename... States > static bool match( Input& in, States&&... st ) { - return duseltronik< seq< Rules... >, apply_mode::NOTHING, M, Action, Control >::match( in, st... ); + return duseltronik< seq< Rules... >, apply_mode::nothing, M, Action, Control >::match( in, st... ); } }; diff --git a/thirdparty/PEGTL/include/tao/pegtl/internal/discard.hpp b/thirdparty/PEGTL/include/tao/pegtl/internal/discard.hpp old mode 100644 new mode 100755 index 89cb2f1..e92f446 --- a/thirdparty/PEGTL/include/tao/pegtl/internal/discard.hpp +++ b/thirdparty/PEGTL/include/tao/pegtl/internal/discard.hpp @@ -1,4 +1,4 @@ -// Copyright (c) 2016-2018 Dr. Colin Hirsch and Daniel Frey +// Copyright (c) 2016-2019 Dr. Colin Hirsch and Daniel Frey // Please see LICENSE for license or visit https://github.com/taocpp/PEGTL/ #ifndef TAO_PEGTL_INTERNAL_DISCARD_HPP @@ -18,7 +18,7 @@ namespace tao { struct discard { - using analyze_t = analysis::generic< analysis::rule_type::OPT >; + using analyze_t = analysis::generic< analysis::rule_type::opt >; template< typename Input > static bool match( Input& in ) noexcept diff --git a/thirdparty/PEGTL/include/tao/pegtl/internal/dusel_mode.hpp b/thirdparty/PEGTL/include/tao/pegtl/internal/dusel_mode.hpp old mode 100644 new mode 100755 index 9fc7a58..ae192db --- a/thirdparty/PEGTL/include/tao/pegtl/internal/dusel_mode.hpp +++ b/thirdparty/PEGTL/include/tao/pegtl/internal/dusel_mode.hpp @@ -1,4 +1,4 @@ -// Copyright (c) 2017-2018 Dr. Colin Hirsch and Daniel Frey +// Copyright (c) 2017-2019 Dr. Colin Hirsch and Daniel Frey // Please see LICENSE for license or visit https://github.com/taocpp/PEGTL/ #ifndef TAO_PEGTL_INTERNAL_DUSEL_MODE_HPP @@ -10,15 +10,19 @@ namespace tao { namespace TAO_PEGTL_NAMESPACE { - enum class dusel_mode : char + namespace internal { - NOTHING = 0, - CONTROL = 1, - CONTROL_AND_APPLY_VOID = 2, - CONTROL_AND_APPLY_BOOL = 3, - CONTROL_AND_APPLY0_VOID = 4, - CONTROL_AND_APPLY0_BOOL = 5 - }; + enum class dusel_mode : char + { + nothing = 0, + control = 1, + control_and_apply_void = 2, + control_and_apply_bool = 3, + control_and_apply0_void = 4, + control_and_apply0_bool = 5, + }; + + } // namespace internal } // namespace TAO_PEGTL_NAMESPACE diff --git a/thirdparty/PEGTL/include/tao/pegtl/internal/duseltronik.hpp b/thirdparty/PEGTL/include/tao/pegtl/internal/duseltronik.hpp old mode 100644 new mode 100755 index 20099a4..90e8d80 --- a/thirdparty/PEGTL/include/tao/pegtl/internal/duseltronik.hpp +++ b/thirdparty/PEGTL/include/tao/pegtl/internal/duseltronik.hpp @@ -1,4 +1,4 @@ -// Copyright (c) 2014-2018 Dr. Colin Hirsch and Daniel Frey +// Copyright (c) 2014-2019 Dr. Colin Hirsch and Daniel Frey // Please see LICENSE for license or visit https://github.com/taocpp/PEGTL/ #ifndef TAO_PEGTL_INTERNAL_DUSELTRONIK_HPP @@ -19,17 +19,21 @@ namespace tao template< typename Rule, apply_mode A, rewind_mode M, - template< typename... > class Action, - template< typename... > class Control, - dusel_mode = dusel_mode::NOTHING > + template< typename... > + class Action, + template< typename... > + class Control, + dusel_mode = dusel_mode::nothing > struct duseltronik; template< typename Rule, apply_mode A, rewind_mode M, - template< typename... > class Action, - template< typename... > class Control > - struct duseltronik< Rule, A, M, Action, Control, dusel_mode::NOTHING > + template< typename... > + class Action, + template< typename... > + class Control > + struct duseltronik< Rule, A, M, Action, Control, dusel_mode::nothing > { template< typename Input, typename... States > static auto match( Input& in, States&&... st ) @@ -51,16 +55,18 @@ namespace tao template< typename Rule, apply_mode A, rewind_mode M, - template< typename... > class Action, - template< typename... > class Control > - struct duseltronik< Rule, A, M, Action, Control, dusel_mode::CONTROL > + template< typename... > + class Action, + template< typename... > + class Control > + struct duseltronik< Rule, A, M, Action, Control, dusel_mode::control > { template< typename Input, typename... States > static bool match( Input& in, States&&... st ) { Control< Rule >::start( static_cast< const Input& >( in ), st... ); - if( duseltronik< Rule, A, M, Action, Control, dusel_mode::NOTHING >::match( in, st... ) ) { + if( duseltronik< Rule, A, M, Action, Control, dusel_mode::nothing >::match( in, st... ) ) { Control< Rule >::success( static_cast< const Input& >( in ), st... ); return true; } @@ -72,18 +78,20 @@ namespace tao template< typename Rule, apply_mode A, rewind_mode M, - template< typename... > class Action, - template< typename... > class Control > - struct duseltronik< Rule, A, M, Action, Control, dusel_mode::CONTROL_AND_APPLY_VOID > + template< typename... > + class Action, + template< typename... > + class Control > + struct duseltronik< Rule, A, M, Action, Control, dusel_mode::control_and_apply_void > { template< typename Input, typename... States > static bool match( Input& in, States&&... st ) { - auto m = in.template mark< rewind_mode::REQUIRED >(); + auto m = in.template mark< rewind_mode::required >(); Control< Rule >::start( static_cast< const Input& >( in ), st... ); - if( duseltronik< Rule, A, rewind_mode::ACTIVE, Action, Control, dusel_mode::NOTHING >::match( in, st... ) ) { + if( duseltronik< Rule, A, rewind_mode::active, Action, Control, dusel_mode::nothing >::match( in, st... ) ) { Control< Rule >::template apply< Action >( m.iterator(), static_cast< const Input& >( in ), st... ); Control< Rule >::success( static_cast< const Input& >( in ), st... ); return m( true ); @@ -96,18 +104,20 @@ namespace tao template< typename Rule, apply_mode A, rewind_mode M, - template< typename... > class Action, - template< typename... > class Control > - struct duseltronik< Rule, A, M, Action, Control, dusel_mode::CONTROL_AND_APPLY_BOOL > + template< typename... > + class Action, + template< typename... > + class Control > + struct duseltronik< Rule, A, M, Action, Control, dusel_mode::control_and_apply_bool > { template< typename Input, typename... States > static bool match( Input& in, States&&... st ) { - auto m = in.template mark< rewind_mode::REQUIRED >(); + auto m = in.template mark< rewind_mode::required >(); Control< Rule >::start( static_cast< const Input& >( in ), st... ); - if( duseltronik< Rule, A, rewind_mode::ACTIVE, Action, Control, dusel_mode::NOTHING >::match( in, st... ) ) { + if( duseltronik< Rule, A, rewind_mode::active, Action, Control, dusel_mode::nothing >::match( in, st... ) ) { if( Control< Rule >::template apply< Action >( m.iterator(), static_cast< const Input& >( in ), st... ) ) { Control< Rule >::success( static_cast< const Input& >( in ), st... ); return m( true ); @@ -121,16 +131,18 @@ namespace tao template< typename Rule, apply_mode A, rewind_mode M, - template< typename... > class Action, - template< typename... > class Control > - struct duseltronik< Rule, A, M, Action, Control, dusel_mode::CONTROL_AND_APPLY0_VOID > + template< typename... > + class Action, + template< typename... > + class Control > + struct duseltronik< Rule, A, M, Action, Control, dusel_mode::control_and_apply0_void > { template< typename Input, typename... States > static bool match( Input& in, States&&... st ) { Control< Rule >::start( static_cast< const Input& >( in ), st... ); - if( duseltronik< Rule, A, M, Action, Control, dusel_mode::NOTHING >::match( in, st... ) ) { + if( duseltronik< Rule, A, M, Action, Control, dusel_mode::nothing >::match( in, st... ) ) { Control< Rule >::template apply0< Action >( static_cast< const Input& >( in ), st... ); Control< Rule >::success( static_cast< const Input& >( in ), st... ); return true; @@ -143,18 +155,20 @@ namespace tao template< typename Rule, apply_mode A, rewind_mode M, - template< typename... > class Action, - template< typename... > class Control > - struct duseltronik< Rule, A, M, Action, Control, dusel_mode::CONTROL_AND_APPLY0_BOOL > + template< typename... > + class Action, + template< typename... > + class Control > + struct duseltronik< Rule, A, M, Action, Control, dusel_mode::control_and_apply0_bool > { template< typename Input, typename... States > static bool match( Input& in, States&&... st ) { - auto m = in.template mark< rewind_mode::REQUIRED >(); + auto m = in.template mark< rewind_mode::required >(); Control< Rule >::start( static_cast< const Input& >( in ), st... ); - if( duseltronik< Rule, A, rewind_mode::ACTIVE, Action, Control, dusel_mode::NOTHING >::match( in, st... ) ) { + if( duseltronik< Rule, A, rewind_mode::active, Action, Control, dusel_mode::nothing >::match( in, st... ) ) { if( Control< Rule >::template apply0< Action >( static_cast< const Input& >( in ), st... ) ) { Control< Rule >::success( static_cast< const Input& >( in ), st... ); return m( true ); diff --git a/thirdparty/PEGTL/include/tao/pegtl/internal/enable.hpp b/thirdparty/PEGTL/include/tao/pegtl/internal/enable.hpp old mode 100644 new mode 100755 index da490c6..f28671d --- a/thirdparty/PEGTL/include/tao/pegtl/internal/enable.hpp +++ b/thirdparty/PEGTL/include/tao/pegtl/internal/enable.hpp @@ -1,4 +1,4 @@ -// Copyright (c) 2014-2018 Dr. Colin Hirsch and Daniel Frey +// Copyright (c) 2014-2019 Dr. Colin Hirsch and Daniel Frey // Please see LICENSE for license or visit https://github.com/taocpp/PEGTL/ #ifndef TAO_PEGTL_INTERNAL_ENABLE_HPP @@ -24,17 +24,19 @@ namespace tao template< typename... Rules > struct enable { - using analyze_t = analysis::generic< analysis::rule_type::SEQ, Rules... >; + using analyze_t = analysis::generic< analysis::rule_type::seq, Rules... >; template< apply_mode, rewind_mode M, - template< typename... > class Action, - template< typename... > class Control, + template< typename... > + class Action, + template< typename... > + class Control, typename Input, typename... States > static bool match( Input& in, States&&... st ) { - return duseltronik< seq< Rules... >, apply_mode::ACTION, M, Action, Control >::match( in, st... ); + return duseltronik< seq< Rules... >, apply_mode::action, M, Action, Control >::match( in, st... ); } }; diff --git a/thirdparty/PEGTL/include/tao/pegtl/internal/endian.hpp b/thirdparty/PEGTL/include/tao/pegtl/internal/endian.hpp old mode 100644 new mode 100755 index b70775c..85bbba3 --- a/thirdparty/PEGTL/include/tao/pegtl/internal/endian.hpp +++ b/thirdparty/PEGTL/include/tao/pegtl/internal/endian.hpp @@ -1,4 +1,4 @@ -// Copyright (c) 2017-2018 Dr. Colin Hirsch and Daniel Frey +// Copyright (c) 2017-2019 Dr. Colin Hirsch and Daniel Frey // Please see LICENSE for license or visit https://github.com/taocpp/PEGTL/ #ifndef TAO_PEGTL_INTERNAL_ENDIAN_HPP diff --git a/thirdparty/PEGTL/include/tao/pegtl/internal/endian_gcc.hpp b/thirdparty/PEGTL/include/tao/pegtl/internal/endian_gcc.hpp old mode 100644 new mode 100755 index a8c514f..49f102d --- a/thirdparty/PEGTL/include/tao/pegtl/internal/endian_gcc.hpp +++ b/thirdparty/PEGTL/include/tao/pegtl/internal/endian_gcc.hpp @@ -1,4 +1,4 @@ -// Copyright (c) 2017-2018 Dr. Colin Hirsch and Daniel Frey +// Copyright (c) 2017-2019 Dr. Colin Hirsch and Daniel Frey // Please see LICENSE for license or visit https://github.com/taocpp/PEGTL/ #ifndef TAO_PEGTL_INTERNAL_ENDIAN_GCC_HPP @@ -13,12 +13,11 @@ namespace tao { namespace internal { - -#if not defined( __BYTE_ORDER__ ) +#if !defined( __BYTE_ORDER__ ) #error No byte order defined! #elif __BYTE_ORDER__ == __ORDER_BIG_ENDIAN__ - template< unsigned S > + template< std::size_t S > struct to_and_from_be { template< typename T > @@ -28,7 +27,7 @@ namespace tao } }; - template< unsigned S > + template< std::size_t S > struct to_and_from_le; template<> @@ -50,7 +49,7 @@ namespace tao { static std::int16_t convert( const std::int16_t n ) noexcept { - return __builtin_bswap16( n ); + return static_cast< std::int16_t >( __builtin_bswap16( static_cast< std::uint16_t >( n ) ) ); } static std::uint16_t convert( const std::uint16_t n ) noexcept @@ -73,7 +72,7 @@ namespace tao static std::int32_t convert( const std::int32_t n ) noexcept { - return __builtin_bswap32( n ); + return static_cast< std::int32_t >( __builtin_bswap32( static_cast< std::uint32_t >( n ) ) ); } static std::uint32_t convert( const std::uint32_t n ) noexcept @@ -96,7 +95,7 @@ namespace tao static std::int64_t convert( const std::int64_t n ) noexcept { - return __builtin_bswap64( n ); + return static_cast< std::int64_t >( __builtin_bswap64( static_cast< std::uint64_t >( n ) ) ); } static std::uint64_t convert( const std::uint64_t n ) noexcept @@ -111,7 +110,7 @@ namespace tao #elif __BYTE_ORDER__ == __ORDER_LITTLE_ENDIAN__ - template< unsigned S > + template< std::size_t S > struct to_and_from_le { template< typename T > @@ -121,7 +120,7 @@ namespace tao } }; - template< unsigned S > + template< std::size_t S > struct to_and_from_be; template<> @@ -143,7 +142,7 @@ namespace tao { static std::int16_t convert( const std::int16_t n ) noexcept { - return __builtin_bswap16( n ); + return static_cast< std::int16_t >( __builtin_bswap16( static_cast< std::uint16_t >( n ) ) ); } static std::uint16_t convert( const std::uint16_t n ) noexcept @@ -166,7 +165,7 @@ namespace tao static std::int32_t convert( const std::int32_t n ) noexcept { - return __builtin_bswap32( n ); + return static_cast< std::int32_t >( __builtin_bswap32( static_cast< std::uint32_t >( n ) ) ); } static std::uint32_t convert( const std::uint32_t n ) noexcept @@ -187,12 +186,12 @@ namespace tao return n; } - static std::uint64_t convert( const std::uint64_t n ) noexcept + static std::int64_t convert( const std::int64_t n ) noexcept { - return __builtin_bswap64( n ); + return static_cast< std::int64_t >( __builtin_bswap64( static_cast< std::uint64_t >( n ) ) ); } - static std::int64_t convert( const std::int64_t n ) noexcept + static std::uint64_t convert( const std::uint64_t n ) noexcept { return __builtin_bswap64( n ); } diff --git a/thirdparty/PEGTL/include/tao/pegtl/internal/endian_win.hpp b/thirdparty/PEGTL/include/tao/pegtl/internal/endian_win.hpp old mode 100644 new mode 100755 index 6b89f5f..ca94915 --- a/thirdparty/PEGTL/include/tao/pegtl/internal/endian_win.hpp +++ b/thirdparty/PEGTL/include/tao/pegtl/internal/endian_win.hpp @@ -1,4 +1,4 @@ -// Copyright (c) 2017-2018 Dr. Colin Hirsch and Daniel Frey +// Copyright (c) 2017-2019 Dr. Colin Hirsch and Daniel Frey // Please see LICENSE for license or visit https://github.com/taocpp/PEGTL/ #ifndef TAO_PEGTL_INTERNAL_ENDIAN_WIN_HPP @@ -15,7 +15,7 @@ namespace tao { namespace internal { - template< unsigned S > + template< std::size_t S > struct to_and_from_le { template< typename T > @@ -25,7 +25,7 @@ namespace tao } }; - template< unsigned S > + template< std::size_t S > struct to_and_from_be; template<> diff --git a/thirdparty/PEGTL/include/tao/pegtl/internal/eof.hpp b/thirdparty/PEGTL/include/tao/pegtl/internal/eof.hpp old mode 100644 new mode 100755 index 51ac283..989ebf4 --- a/thirdparty/PEGTL/include/tao/pegtl/internal/eof.hpp +++ b/thirdparty/PEGTL/include/tao/pegtl/internal/eof.hpp @@ -1,4 +1,4 @@ -// Copyright (c) 2014-2018 Dr. Colin Hirsch and Daniel Frey +// Copyright (c) 2014-2019 Dr. Colin Hirsch and Daniel Frey // Please see LICENSE for license or visit https://github.com/taocpp/PEGTL/ #ifndef TAO_PEGTL_INTERNAL_EOF_HPP @@ -18,7 +18,7 @@ namespace tao { struct eof { - using analyze_t = analysis::generic< analysis::rule_type::OPT >; + using analyze_t = analysis::generic< analysis::rule_type::opt >; template< typename Input > static bool match( Input& in ) noexcept( noexcept( in.empty() ) ) diff --git a/thirdparty/PEGTL/include/tao/pegtl/internal/eol.hpp b/thirdparty/PEGTL/include/tao/pegtl/internal/eol.hpp old mode 100644 new mode 100755 index 9aae616..7057342 --- a/thirdparty/PEGTL/include/tao/pegtl/internal/eol.hpp +++ b/thirdparty/PEGTL/include/tao/pegtl/internal/eol.hpp @@ -1,4 +1,4 @@ -// Copyright (c) 2016-2018 Dr. Colin Hirsch and Daniel Frey +// Copyright (c) 2016-2019 Dr. Colin Hirsch and Daniel Frey // Please see LICENSE for license or visit https://github.com/taocpp/PEGTL/ #ifndef TAO_PEGTL_INTERNAL_EOL_HPP @@ -18,7 +18,7 @@ namespace tao { struct eol { - using analyze_t = analysis::generic< analysis::rule_type::ANY >; + using analyze_t = analysis::generic< analysis::rule_type::any >; template< typename Input > static bool match( Input& in ) noexcept( noexcept( Input::eol_t::match( in ) ) ) diff --git a/thirdparty/PEGTL/include/tao/pegtl/internal/eolf.hpp b/thirdparty/PEGTL/include/tao/pegtl/internal/eolf.hpp old mode 100644 new mode 100755 index 777b814..48a4138 --- a/thirdparty/PEGTL/include/tao/pegtl/internal/eolf.hpp +++ b/thirdparty/PEGTL/include/tao/pegtl/internal/eolf.hpp @@ -1,4 +1,4 @@ -// Copyright (c) 2014-2018 Dr. Colin Hirsch and Daniel Frey +// Copyright (c) 2014-2019 Dr. Colin Hirsch and Daniel Frey // Please see LICENSE for license or visit https://github.com/taocpp/PEGTL/ #ifndef TAO_PEGTL_INTERNAL_EOLF_HPP @@ -18,7 +18,7 @@ namespace tao { struct eolf { - using analyze_t = analysis::generic< analysis::rule_type::OPT >; + using analyze_t = analysis::generic< analysis::rule_type::opt >; template< typename Input > static bool match( Input& in ) noexcept( noexcept( Input::eol_t::match( in ) ) ) diff --git a/thirdparty/PEGTL/include/tao/pegtl/internal/file_mapper_posix.hpp b/thirdparty/PEGTL/include/tao/pegtl/internal/file_mapper_posix.hpp old mode 100644 new mode 100755 index ef7ad8e..ff58eda --- a/thirdparty/PEGTL/include/tao/pegtl/internal/file_mapper_posix.hpp +++ b/thirdparty/PEGTL/include/tao/pegtl/internal/file_mapper_posix.hpp @@ -1,4 +1,4 @@ -// Copyright (c) 2014-2018 Dr. Colin Hirsch and Daniel Frey +// Copyright (c) 2014-2019 Dr. Colin Hirsch and Daniel Frey // Please see LICENSE for license or visit https://github.com/taocpp/PEGTL/ #ifndef TAO_PEGTL_INTERNAL_FILE_MAPPER_POSIX_HPP @@ -29,7 +29,7 @@ namespace tao explicit file_mapper( const file_opener& reader ) : m_size( reader.size() ), - m_data( static_cast< const char* >(::mmap( nullptr, m_size, PROT_READ, MAP_PRIVATE, reader.m_fd, 0 ) ) ) + m_data( static_cast< const char* >( ::mmap( nullptr, m_size, PROT_READ, MAP_PRIVATE, reader.m_fd, 0 ) ) ) { if( ( m_size != 0 ) && ( intptr_t( m_data ) == -1 ) ) { TAO_PEGTL_THROW_INPUT_ERROR( "unable to mmap() file " << reader.m_source << " descriptor " << reader.m_fd ); diff --git a/thirdparty/PEGTL/include/tao/pegtl/internal/file_mapper_win32.hpp b/thirdparty/PEGTL/include/tao/pegtl/internal/file_mapper_win32.hpp old mode 100644 new mode 100755 index 0f4d8f2..11b249e --- a/thirdparty/PEGTL/include/tao/pegtl/internal/file_mapper_win32.hpp +++ b/thirdparty/PEGTL/include/tao/pegtl/internal/file_mapper_win32.hpp @@ -1,4 +1,4 @@ -// Copyright (c) 2014-2018 Dr. Colin Hirsch and Daniel Frey +// Copyright (c) 2014-2019 Dr. Colin Hirsch and Daniel Frey // Please see LICENSE for license or visit https://github.com/taocpp/PEGTL/ #ifndef TAO_PEGTL_INTERNAL_FILE_MAPPER_WIN32_HPP @@ -10,8 +10,8 @@ #endif #if !defined( WIN32_LEAN_AND_MEAN ) -#define WIN32_MEAN_AND_LEAN -#define TAO_PEGTL_WIN32_MEAN_AND_LEAN_WAS_DEFINED +#define WIN32_LEAN_AND_MEAN +#define TAO_PEGTL_WIN32_LEAN_AND_MEAN_WAS_DEFINED #endif #include @@ -21,9 +21,9 @@ #undef TAO_PEGTL_NOMINMAX_WAS_DEFINED #endif -#if defined( TAO_PEGTL_WIN32_MEAN_AND_LEAN_WAS_DEFINED ) -#undef WIN32_MEAN_AND_LEAN -#undef TAO_PEGTL_WIN32_MEAN_AND_LEAN_WAS_DEFINED +#if defined( TAO_PEGTL_WIN32_LEAN_AND_MEAN_WAS_DEFINED ) +#undef WIN32_LEAN_AND_MEAN +#undef TAO_PEGTL_WIN32_LEAN_AND_MEAN_WAS_DEFINED #endif #include "../config.hpp" @@ -70,7 +70,20 @@ namespace tao HANDLE open() const { SetLastError( 0 ); - const HANDLE handle = ::CreateFileA( m_source, + std::wstring ws( m_source, m_source + strlen( m_source ) ); + +#if( _WIN32_WINNT >= 0x0602 ) + const HANDLE handle = ::CreateFile2( ws.c_str(), + GENERIC_READ, + FILE_SHARE_READ, + OPEN_EXISTING, + nullptr ); + if( handle != INVALID_HANDLE_VALUE ) { + return handle; + } + TAO_PEGTL_THROW_INPUT_WIN32_ERROR( "CreateFile2() failed opening file " << m_source << " for reading" ); +#else + const HANDLE handle = ::CreateFileW( ws.c_str(), GENERIC_READ, FILE_SHARE_READ, nullptr, @@ -80,7 +93,8 @@ namespace tao if( handle != INVALID_HANDLE_VALUE ) { return handle; } - TAO_PEGTL_THROW_INPUT_WIN32_ERROR( "unable to CreateFileA() file " << m_source << " for reading" ); + TAO_PEGTL_THROW_INPUT_WIN32_ERROR( "CreateFileW() failed opening file " << m_source << " for reading" ); +#endif } }; @@ -143,11 +157,11 @@ namespace tao explicit file_mapper( const win32_file_mapper& mapper ) : m_size( mapper.m_size ), - m_data( static_cast< const char* const >(::MapViewOfFile( mapper.m_handle, - FILE_MAP_READ, - 0, - 0, - 0 ) ) ) + m_data( static_cast< const char* >( ::MapViewOfFile( mapper.m_handle, + FILE_MAP_READ, + 0, + 0, + 0 ) ) ) { if( ( m_size != 0 ) && ( intptr_t( m_data ) == 0 ) ) { TAO_PEGTL_THROW_INPUT_WIN32_ERROR( "unable to MapViewOfFile() file mapping object with handle " << mapper.m_handle ); diff --git a/thirdparty/PEGTL/include/tao/pegtl/internal/file_opener.hpp b/thirdparty/PEGTL/include/tao/pegtl/internal/file_opener.hpp old mode 100644 new mode 100755 index 478f5fc..50f4a4e --- a/thirdparty/PEGTL/include/tao/pegtl/internal/file_opener.hpp +++ b/thirdparty/PEGTL/include/tao/pegtl/internal/file_opener.hpp @@ -1,4 +1,4 @@ -// Copyright (c) 2014-2018 Dr. Colin Hirsch and Daniel Frey +// Copyright (c) 2014-2019 Dr. Colin Hirsch and Daniel Frey // Please see LICENSE for license or visit https://github.com/taocpp/PEGTL/ #ifndef TAO_PEGTL_INTERNAL_FILE_OPENER_HPP @@ -43,7 +43,7 @@ namespace tao { struct stat st; // NOLINT errno = 0; - if(::fstat( m_fd, &st ) < 0 ) { + if( ::fstat( m_fd, &st ) < 0 ) { TAO_PEGTL_THROW_INPUT_ERROR( "unable to fstat() file " << m_source << " descriptor " << m_fd ); } return std::size_t( st.st_size ); diff --git a/thirdparty/PEGTL/include/tao/pegtl/internal/file_reader.hpp b/thirdparty/PEGTL/include/tao/pegtl/internal/file_reader.hpp old mode 100644 new mode 100755 index 6d95f8b..b61386d --- a/thirdparty/PEGTL/include/tao/pegtl/internal/file_reader.hpp +++ b/thirdparty/PEGTL/include/tao/pegtl/internal/file_reader.hpp @@ -1,4 +1,4 @@ -// Copyright (c) 2014-2018 Dr. Colin Hirsch and Daniel Frey +// Copyright (c) 2014-2019 Dr. Colin Hirsch and Daniel Frey // Please see LICENSE for license or visit https://github.com/taocpp/PEGTL/ #ifndef TAO_PEGTL_INTERNAL_FILE_READER_HPP @@ -23,7 +23,7 @@ namespace tao errno = 0; #if defined( _MSC_VER ) std::FILE* file; - if(::fopen_s( &file, filename, "rb" ) == 0 ) + if( ::fopen_s( &file, filename, "rb" ) == 0 ) #elif defined( __MINGW32__ ) if( auto* file = std::fopen( filename, "rb" ) ) // NOLINT(cppcoreguidelines-owning-memory) #else diff --git a/thirdparty/PEGTL/include/tao/pegtl/internal/has_apply.hpp b/thirdparty/PEGTL/include/tao/pegtl/internal/has_apply.hpp old mode 100644 new mode 100755 index 4a4f8db..709492b --- a/thirdparty/PEGTL/include/tao/pegtl/internal/has_apply.hpp +++ b/thirdparty/PEGTL/include/tao/pegtl/internal/has_apply.hpp @@ -1,4 +1,4 @@ -// Copyright (c) 2017-2018 Dr. Colin Hirsch and Daniel Frey +// Copyright (c) 2017-2019 Dr. Colin Hirsch and Daniel Frey // Please see LICENSE for license or visit https://github.com/taocpp/PEGTL/ #ifndef TAO_PEGTL_INTERNAL_HAS_APPLY_HPP @@ -14,15 +14,15 @@ namespace tao { namespace internal { - template< typename, typename, typename... > - struct has_apply : std::false_type - { - }; - - template< typename A, typename... S > - struct has_apply< A, decltype( A::apply( std::declval< S >()... ) ), S... > : std::true_type - { - }; + template< typename, typename, template< typename... > class, typename... > + struct has_apply + : std::false_type + {}; + + template< typename C, template< typename... > class Action, typename... S > + struct has_apply< C, decltype( C::template apply< Action >( std::declval< S >()... ) ), Action, S... > + : std::true_type + {}; } // namespace internal diff --git a/thirdparty/PEGTL/include/tao/pegtl/internal/has_apply0.hpp b/thirdparty/PEGTL/include/tao/pegtl/internal/has_apply0.hpp old mode 100644 new mode 100755 index 6b1e486..aa024a9 --- a/thirdparty/PEGTL/include/tao/pegtl/internal/has_apply0.hpp +++ b/thirdparty/PEGTL/include/tao/pegtl/internal/has_apply0.hpp @@ -1,4 +1,4 @@ -// Copyright (c) 2017-2018 Dr. Colin Hirsch and Daniel Frey +// Copyright (c) 2017-2019 Dr. Colin Hirsch and Daniel Frey // Please see LICENSE for license or visit https://github.com/taocpp/PEGTL/ #ifndef TAO_PEGTL_INTERNAL_HAS_APPLY0_HPP @@ -14,15 +14,15 @@ namespace tao { namespace internal { - template< typename, typename, typename... > - struct has_apply0 : std::false_type - { - }; - - template< typename A, typename... S > - struct has_apply0< A, decltype( A::apply0( std::declval< S >()... ) ), S... > : std::true_type - { - }; + template< typename, typename, template< typename... > class, typename... > + struct has_apply0 + : std::false_type + {}; + + template< typename C, template< typename... > class Action, typename... S > + struct has_apply0< C, decltype( C::template apply0< Action >( std::declval< S >()... ) ), Action, S... > + : std::true_type + {}; } // namespace internal diff --git a/thirdparty/PEGTL/include/tao/pegtl/internal/has_match.hpp b/thirdparty/PEGTL/include/tao/pegtl/internal/has_match.hpp new file mode 100755 index 0000000..7540490 --- /dev/null +++ b/thirdparty/PEGTL/include/tao/pegtl/internal/has_match.hpp @@ -0,0 +1,53 @@ +// Copyright (c) 2019 Dr. Colin Hirsch and Daniel Frey +// Please see LICENSE for license or visit https://github.com/taocpp/PEGTL/ + +#ifndef TAO_PEGTL_INTERNAL_HAS_MATCH_HPP +#define TAO_PEGTL_INTERNAL_HAS_MATCH_HPP + +#include +#include + +#include "../apply_mode.hpp" +#include "../config.hpp" +#include "../rewind_mode.hpp" + +namespace tao +{ + namespace TAO_PEGTL_NAMESPACE + { + namespace internal + { + template< typename, + typename Rule, + apply_mode A, + rewind_mode M, + template< typename... > + class Action, + template< typename... > + class Control, + typename Input, + typename... States > + struct has_match + : std::false_type + {}; + + template< typename Rule, + apply_mode A, + rewind_mode M, + template< typename... > + class Action, + template< typename... > + class Control, + typename Input, + typename... States > + struct has_match< decltype( Action< Rule >::template match< Rule, A, M, Action, Control >( std::declval< Input& >(), std::declval< States&& >()... ), void() ), Rule, A, M, Action, Control, Input, States... > + : std::true_type + {}; + + } // namespace internal + + } // namespace TAO_PEGTL_NAMESPACE + +} // namespace tao + +#endif diff --git a/thirdparty/PEGTL/include/tao/pegtl/internal/identifier.hpp b/thirdparty/PEGTL/include/tao/pegtl/internal/identifier.hpp old mode 100644 new mode 100755 index 59f6218..7005024 --- a/thirdparty/PEGTL/include/tao/pegtl/internal/identifier.hpp +++ b/thirdparty/PEGTL/include/tao/pegtl/internal/identifier.hpp @@ -1,4 +1,4 @@ -// Copyright (c) 2017-2018 Dr. Colin Hirsch and Daniel Frey +// Copyright (c) 2017-2019 Dr. Colin Hirsch and Daniel Frey // Please see LICENSE for license or visit https://github.com/taocpp/PEGTL/ #ifndef TAO_PEGTL_INTERNAL_IDENTIFIER_HPP diff --git a/thirdparty/PEGTL/include/tao/pegtl/internal/if_apply.hpp b/thirdparty/PEGTL/include/tao/pegtl/internal/if_apply.hpp old mode 100644 new mode 100755 index 58d0e97..204e9eb --- a/thirdparty/PEGTL/include/tao/pegtl/internal/if_apply.hpp +++ b/thirdparty/PEGTL/include/tao/pegtl/internal/if_apply.hpp @@ -1,4 +1,4 @@ -// Copyright (c) 2017-2018 Dr. Colin Hirsch and Daniel Frey +// Copyright (c) 2017-2019 Dr. Colin Hirsch and Daniel Frey // Please see LICENSE for license or visit https://github.com/taocpp/PEGTL/ #ifndef TAO_PEGTL_INTERNAL_IF_APPLY_HPP @@ -23,34 +23,38 @@ namespace tao struct if_apply_impl; template< typename Rule > - struct if_apply_impl< apply_mode::ACTION, Rule > + struct if_apply_impl< apply_mode::action, Rule > { template< rewind_mode M, - template< typename... > class Action, - template< typename... > class Control, + template< typename... > + class Action, + template< typename... > + class Control, typename Input, typename... States > static bool match( Input& in, States&&... st ) { - return Control< Rule >::template match< apply_mode::ACTION, M, Action, Control >( in, st... ); + return Control< Rule >::template match< apply_mode::action, M, Action, Control >( in, st... ); } }; template< typename Rule, typename... Actions > - struct if_apply_impl< apply_mode::ACTION, Rule, Actions... > + struct if_apply_impl< apply_mode::action, Rule, Actions... > { template< rewind_mode, - template< typename... > class Action, - template< typename... > class Control, + template< typename... > + class Action, + template< typename... > + class Control, typename Input, typename... States > static bool match( Input& in, States&&... st ) { using action_t = typename Input::action_t; - auto m = in.template mark< rewind_mode::REQUIRED >(); + auto m = in.template mark< rewind_mode::required >(); - if( Control< Rule >::template match< apply_mode::ACTION, rewind_mode::ACTIVE, Action, Control >( in, st... ) ) { + if( Control< Rule >::template match< apply_mode::action, rewind_mode::active, Action, Control >( in, st... ) ) { const action_t i2( m.iterator(), in ); #ifdef __cpp_fold_expressions return m( ( apply_single< Actions >::match( i2, st... ) && ... ) ); @@ -66,16 +70,18 @@ namespace tao }; template< typename Rule, typename... Actions > - struct if_apply_impl< apply_mode::NOTHING, Rule, Actions... > + struct if_apply_impl< apply_mode::nothing, Rule, Actions... > { template< rewind_mode M, - template< typename... > class Action, - template< typename... > class Control, + template< typename... > + class Action, + template< typename... > + class Control, typename Input, typename... States > static bool match( Input& in, States&&... st ) { - return Control< Rule >::template match< apply_mode::NOTHING, M, Action, Control >( in, st... ); + return Control< Rule >::template match< apply_mode::nothing, M, Action, Control >( in, st... ); } }; @@ -86,8 +92,10 @@ namespace tao template< apply_mode A, rewind_mode M, - template< typename... > class Action, - template< typename... > class Control, + template< typename... > + class Action, + template< typename... > + class Control, typename Input, typename... States > static bool match( Input& in, States&&... st ) diff --git a/thirdparty/PEGTL/include/tao/pegtl/internal/if_missing.hpp b/thirdparty/PEGTL/include/tao/pegtl/internal/if_missing.hpp new file mode 100755 index 0000000..a8cc3a1 --- /dev/null +++ b/thirdparty/PEGTL/include/tao/pegtl/internal/if_missing.hpp @@ -0,0 +1,72 @@ +// Copyright (c) 2019 Dr. Colin Hirsch and Daniel Frey +// Please see LICENSE for license or visit https://github.com/taocpp/PEGTL/ + +#ifndef TAO_PEGTL_INTERNAL_IF_MISSING_HPP +#define TAO_PEGTL_INTERNAL_IF_MISSING_HPP + +#include "../config.hpp" +#include "../rewind_mode.hpp" + +namespace tao +{ + namespace TAO_PEGTL_NAMESPACE + { + namespace internal + { + template< bool > + struct if_missing; + + template<> + struct if_missing< true > + { + template< typename Control, + template< typename... > + class Action, + typename Input, + typename... States > + static void apply( Input& in, States&&... st ) + { + auto m = in.template mark< rewind_mode::required >(); + Control::template apply< Action >( m.iterator(), in, st... ); + } + + template< typename Control, + template< typename... > + class Action, + typename Input, + typename... States > + static void apply0( Input& in, States&&... st ) + { + Control::template apply0< Action >( in, st... ); + } + }; + + template<> + struct if_missing< false > + { + template< typename Control, + template< typename... > + class Action, + typename Input, + typename... States > + static void apply( Input& /*unused*/, States&&... /*unused*/ ) + { + } + + template< typename Control, + template< typename... > + class Action, + typename Input, + typename... States > + static void apply0( Input& /*unused*/, States&&... /*unused*/ ) + { + } + }; + + } // namespace internal + + } // namespace TAO_PEGTL_NAMESPACE + +} // namespace tao + +#endif diff --git a/thirdparty/PEGTL/include/tao/pegtl/internal/if_must.hpp b/thirdparty/PEGTL/include/tao/pegtl/internal/if_must.hpp old mode 100644 new mode 100755 index f81fee4..ad0be99 --- a/thirdparty/PEGTL/include/tao/pegtl/internal/if_must.hpp +++ b/thirdparty/PEGTL/include/tao/pegtl/internal/if_must.hpp @@ -1,4 +1,4 @@ -// Copyright (c) 2014-2018 Dr. Colin Hirsch and Daniel Frey +// Copyright (c) 2014-2019 Dr. Colin Hirsch and Daniel Frey // Please see LICENSE for license or visit https://github.com/taocpp/PEGTL/ #ifndef TAO_PEGTL_INTERNAL_IF_MUST_HPP @@ -25,12 +25,14 @@ namespace tao template< bool Default, typename Cond, typename... Rules > struct if_must { - using analyze_t = analysis::counted< analysis::rule_type::SEQ, Default ? 0 : 1, Cond, must< Rules... > >; + using analyze_t = analysis::counted< analysis::rule_type::seq, Default ? 0 : 1, Cond, must< Rules... > >; template< apply_mode A, rewind_mode M, - template< typename... > class Action, - template< typename... > class Control, + template< typename... > + class Action, + template< typename... > + class Control, typename Input, typename... States > static bool match( Input& in, States&&... st ) diff --git a/thirdparty/PEGTL/include/tao/pegtl/internal/if_must_else.hpp b/thirdparty/PEGTL/include/tao/pegtl/internal/if_must_else.hpp old mode 100644 new mode 100755 index f049bcb..76fd2bd --- a/thirdparty/PEGTL/include/tao/pegtl/internal/if_must_else.hpp +++ b/thirdparty/PEGTL/include/tao/pegtl/internal/if_must_else.hpp @@ -1,4 +1,4 @@ -// Copyright (c) 2014-2018 Dr. Colin Hirsch and Daniel Frey +// Copyright (c) 2014-2019 Dr. Colin Hirsch and Daniel Frey // Please see LICENSE for license or visit https://github.com/taocpp/PEGTL/ #ifndef TAO_PEGTL_INTERNAL_IF_MUST_ELSE_HPP diff --git a/thirdparty/PEGTL/include/tao/pegtl/internal/if_then_else.hpp b/thirdparty/PEGTL/include/tao/pegtl/internal/if_then_else.hpp old mode 100644 new mode 100755 index 5e851d8..0b844a7 --- a/thirdparty/PEGTL/include/tao/pegtl/internal/if_then_else.hpp +++ b/thirdparty/PEGTL/include/tao/pegtl/internal/if_then_else.hpp @@ -1,4 +1,4 @@ -// Copyright (c) 2014-2018 Dr. Colin Hirsch and Daniel Frey +// Copyright (c) 2014-2019 Dr. Colin Hirsch and Daniel Frey // Please see LICENSE for license or visit https://github.com/taocpp/PEGTL/ #ifndef TAO_PEGTL_INTERNAL_IF_THEN_ELSE_HPP @@ -25,12 +25,14 @@ namespace tao template< typename Cond, typename Then, typename Else > struct if_then_else { - using analyze_t = analysis::generic< analysis::rule_type::SOR, seq< Cond, Then >, seq< not_at< Cond >, Else > >; + using analyze_t = analysis::generic< analysis::rule_type::sor, seq< Cond, Then >, seq< not_at< Cond >, Else > >; template< apply_mode A, rewind_mode M, - template< typename... > class Action, - template< typename... > class Control, + template< typename... > + class Action, + template< typename... > + class Control, typename Input, typename... States > static bool match( Input& in, States&&... st ) @@ -38,7 +40,7 @@ namespace tao auto m = in.template mark< M >(); using m_t = decltype( m ); - if( Control< Cond >::template match< A, rewind_mode::REQUIRED, Action, Control >( in, st... ) ) { + if( Control< Cond >::template match< A, rewind_mode::required, Action, Control >( in, st... ) ) { return m( Control< Then >::template match< A, m_t::next_rewind_mode, Action, Control >( in, st... ) ); } return m( Control< Else >::template match< A, m_t::next_rewind_mode, Action, Control >( in, st... ) ); diff --git a/thirdparty/PEGTL/include/tao/pegtl/internal/input_pair.hpp b/thirdparty/PEGTL/include/tao/pegtl/internal/input_pair.hpp old mode 100644 new mode 100755 index 362b07c..0dcbfdc --- a/thirdparty/PEGTL/include/tao/pegtl/internal/input_pair.hpp +++ b/thirdparty/PEGTL/include/tao/pegtl/internal/input_pair.hpp @@ -1,4 +1,4 @@ -// Copyright (c) 2014-2018 Dr. Colin Hirsch and Daniel Frey +// Copyright (c) 2014-2019 Dr. Colin Hirsch and Daniel Frey // Please see LICENSE for license or visit https://github.com/taocpp/PEGTL/ #ifndef TAO_PEGTL_INTERNAL_INPUT_PAIR_HPP diff --git a/thirdparty/PEGTL/include/tao/pegtl/internal/integer_sequence.hpp b/thirdparty/PEGTL/include/tao/pegtl/internal/integer_sequence.hpp old mode 100644 new mode 100755 index 29aeff6..0657eb7 --- a/thirdparty/PEGTL/include/tao/pegtl/internal/integer_sequence.hpp +++ b/thirdparty/PEGTL/include/tao/pegtl/internal/integer_sequence.hpp @@ -1,4 +1,4 @@ -// Copyright (c) 2017-2018 Dr. Colin Hirsch and Daniel Frey +// Copyright (c) 2017-2019 Dr. Colin Hirsch and Daniel Frey // Please see LICENSE for license or visit https://github.com/taocpp/PEGTL/ #ifndef TAO_PEGTL_INTERNAL_INTEGER_SEQUENCE_HPP diff --git a/thirdparty/PEGTL/include/tao/pegtl/internal/istream_reader.hpp b/thirdparty/PEGTL/include/tao/pegtl/internal/istream_reader.hpp old mode 100644 new mode 100755 index 592c15e..eb60310 --- a/thirdparty/PEGTL/include/tao/pegtl/internal/istream_reader.hpp +++ b/thirdparty/PEGTL/include/tao/pegtl/internal/istream_reader.hpp @@ -1,4 +1,4 @@ -// Copyright (c) 2016-2018 Dr. Colin Hirsch and Daniel Frey +// Copyright (c) 2016-2019 Dr. Colin Hirsch and Daniel Frey // Please see LICENSE for license or visit https://github.com/taocpp/PEGTL/ #ifndef TAO_PEGTL_INTERNAL_ISTREAM_READER_HPP diff --git a/thirdparty/PEGTL/include/tao/pegtl/internal/istring.hpp b/thirdparty/PEGTL/include/tao/pegtl/internal/istring.hpp old mode 100644 new mode 100755 index 5c8c4ab..0f29be1 --- a/thirdparty/PEGTL/include/tao/pegtl/internal/istring.hpp +++ b/thirdparty/PEGTL/include/tao/pegtl/internal/istring.hpp @@ -1,4 +1,4 @@ -// Copyright (c) 2014-2018 Dr. Colin Hirsch and Daniel Frey +// Copyright (c) 2014-2019 Dr. Colin Hirsch and Daniel Frey // Please see LICENSE for license or visit https://github.com/taocpp/PEGTL/ #ifndef TAO_PEGTL_INTERNAL_ISTRING_HPP @@ -78,14 +78,14 @@ namespace tao template< char... Cs > struct istring { - using analyze_t = analysis::counted< analysis::rule_type::ANY, sizeof...( Cs ) >; + using analyze_t = analysis::counted< analysis::rule_type::any, sizeof...( Cs ) >; template< typename Input > static bool match( Input& in ) noexcept( noexcept( in.size( 0 ) ) ) { if( in.size( sizeof...( Cs ) ) >= sizeof...( Cs ) ) { if( istring_equal< Cs... >::match( in.current() ) ) { - bump_help< result_on_found::SUCCESS, Input, char, Cs... >( in, sizeof...( Cs ) ); + bump_help< result_on_found::success, Input, char, Cs... >( in, sizeof...( Cs ) ); return true; } } diff --git a/thirdparty/PEGTL/include/tao/pegtl/internal/iterator.hpp b/thirdparty/PEGTL/include/tao/pegtl/internal/iterator.hpp old mode 100644 new mode 100755 index 4bc46f3..e2c5572 --- a/thirdparty/PEGTL/include/tao/pegtl/internal/iterator.hpp +++ b/thirdparty/PEGTL/include/tao/pegtl/internal/iterator.hpp @@ -1,4 +1,4 @@ -// Copyright (c) 2017-2018 Dr. Colin Hirsch and Daniel Frey +// Copyright (c) 2017-2019 Dr. Colin Hirsch and Daniel Frey // Please see LICENSE for license or visit https://github.com/taocpp/PEGTL/ #ifndef TAO_PEGTL_INTERNAL_ITERATOR_HPP diff --git a/thirdparty/PEGTL/include/tao/pegtl/internal/lf_crlf_eol.hpp b/thirdparty/PEGTL/include/tao/pegtl/internal/lf_crlf_eol.hpp old mode 100644 new mode 100755 index 27a47c4..f538514 --- a/thirdparty/PEGTL/include/tao/pegtl/internal/lf_crlf_eol.hpp +++ b/thirdparty/PEGTL/include/tao/pegtl/internal/lf_crlf_eol.hpp @@ -1,4 +1,4 @@ -// Copyright (c) 2016-2018 Dr. Colin Hirsch and Daniel Frey +// Copyright (c) 2016-2019 Dr. Colin Hirsch and Daniel Frey // Please see LICENSE for license or visit https://github.com/taocpp/PEGTL/ #ifndef TAO_PEGTL_INTERNAL_LF_CRLF_EOL_HPP diff --git a/thirdparty/PEGTL/include/tao/pegtl/internal/lf_eol.hpp b/thirdparty/PEGTL/include/tao/pegtl/internal/lf_eol.hpp old mode 100644 new mode 100755 index 0104126..f462e73 --- a/thirdparty/PEGTL/include/tao/pegtl/internal/lf_eol.hpp +++ b/thirdparty/PEGTL/include/tao/pegtl/internal/lf_eol.hpp @@ -1,4 +1,4 @@ -// Copyright (c) 2016-2018 Dr. Colin Hirsch and Daniel Frey +// Copyright (c) 2016-2019 Dr. Colin Hirsch and Daniel Frey // Please see LICENSE for license or visit https://github.com/taocpp/PEGTL/ #ifndef TAO_PEGTL_INTERNAL_LF_EOL_HPP diff --git a/thirdparty/PEGTL/include/tao/pegtl/internal/list.hpp b/thirdparty/PEGTL/include/tao/pegtl/internal/list.hpp old mode 100644 new mode 100755 index 7068d9c..24fb5d4 --- a/thirdparty/PEGTL/include/tao/pegtl/internal/list.hpp +++ b/thirdparty/PEGTL/include/tao/pegtl/internal/list.hpp @@ -1,4 +1,4 @@ -// Copyright (c) 2014-2018 Dr. Colin Hirsch and Daniel Frey +// Copyright (c) 2014-2019 Dr. Colin Hirsch and Daniel Frey // Please see LICENSE for license or visit https://github.com/taocpp/PEGTL/ #ifndef TAO_PEGTL_INTERNAL_LIST_HPP diff --git a/thirdparty/PEGTL/include/tao/pegtl/internal/list_must.hpp b/thirdparty/PEGTL/include/tao/pegtl/internal/list_must.hpp old mode 100644 new mode 100755 index c473f2d..33a6e9a --- a/thirdparty/PEGTL/include/tao/pegtl/internal/list_must.hpp +++ b/thirdparty/PEGTL/include/tao/pegtl/internal/list_must.hpp @@ -1,4 +1,4 @@ -// Copyright (c) 2014-2018 Dr. Colin Hirsch and Daniel Frey +// Copyright (c) 2014-2019 Dr. Colin Hirsch and Daniel Frey // Please see LICENSE for license or visit https://github.com/taocpp/PEGTL/ #ifndef TAO_PEGTL_INTERNAL_LIST_MUST_HPP diff --git a/thirdparty/PEGTL/include/tao/pegtl/internal/list_tail.hpp b/thirdparty/PEGTL/include/tao/pegtl/internal/list_tail.hpp old mode 100644 new mode 100755 index e651df8..bf11ee8 --- a/thirdparty/PEGTL/include/tao/pegtl/internal/list_tail.hpp +++ b/thirdparty/PEGTL/include/tao/pegtl/internal/list_tail.hpp @@ -1,4 +1,4 @@ -// Copyright (c) 2014-2018 Dr. Colin Hirsch and Daniel Frey +// Copyright (c) 2014-2019 Dr. Colin Hirsch and Daniel Frey // Please see LICENSE for license or visit https://github.com/taocpp/PEGTL/ #ifndef TAO_PEGTL_INTERNAL_LIST_TAIL_HPP diff --git a/thirdparty/PEGTL/include/tao/pegtl/internal/list_tail_pad.hpp b/thirdparty/PEGTL/include/tao/pegtl/internal/list_tail_pad.hpp old mode 100644 new mode 100755 index 291bcad..e629327 --- a/thirdparty/PEGTL/include/tao/pegtl/internal/list_tail_pad.hpp +++ b/thirdparty/PEGTL/include/tao/pegtl/internal/list_tail_pad.hpp @@ -1,4 +1,4 @@ -// Copyright (c) 2014-2018 Dr. Colin Hirsch and Daniel Frey +// Copyright (c) 2014-2019 Dr. Colin Hirsch and Daniel Frey // Please see LICENSE for license or visit https://github.com/taocpp/PEGTL/ #ifndef TAO_PEGTL_INTERNAL_LIST_TAIL_PAD_HPP diff --git a/thirdparty/PEGTL/include/tao/pegtl/internal/marker.hpp b/thirdparty/PEGTL/include/tao/pegtl/internal/marker.hpp old mode 100644 new mode 100755 index c11ad49..4d20dd6 --- a/thirdparty/PEGTL/include/tao/pegtl/internal/marker.hpp +++ b/thirdparty/PEGTL/include/tao/pegtl/internal/marker.hpp @@ -1,4 +1,4 @@ -// Copyright (c) 2014-2018 Dr. Colin Hirsch and Daniel Frey +// Copyright (c) 2014-2019 Dr. Colin Hirsch and Daniel Frey // Please see LICENSE for license or visit https://github.com/taocpp/PEGTL/ #ifndef TAO_PEGTL_INTERNAL_MARKER_HPP @@ -41,10 +41,10 @@ namespace tao }; template< typename Iterator > - class marker< Iterator, rewind_mode::REQUIRED > + class marker< Iterator, rewind_mode::required > { public: - static constexpr rewind_mode next_rewind_mode = rewind_mode::ACTIVE; + static constexpr rewind_mode next_rewind_mode = rewind_mode::active; explicit marker( Iterator& i ) noexcept : m_saved( i ), diff --git a/thirdparty/PEGTL/include/tao/pegtl/internal/minus.hpp b/thirdparty/PEGTL/include/tao/pegtl/internal/minus.hpp deleted file mode 100644 index 9481c82..0000000 --- a/thirdparty/PEGTL/include/tao/pegtl/internal/minus.hpp +++ /dev/null @@ -1,69 +0,0 @@ -// Copyright (c) 2016-2018 Dr. Colin Hirsch and Daniel Frey -// Please see LICENSE for license or visit https://github.com/taocpp/PEGTL/ - -#ifndef TAO_PEGTL_INTERNAL_MINUS_HPP -#define TAO_PEGTL_INTERNAL_MINUS_HPP - -#include "../config.hpp" - -#include "skip_control.hpp" - -#include "../apply_mode.hpp" -#include "../memory_input.hpp" -#include "../rewind_mode.hpp" - -namespace tao -{ - namespace TAO_PEGTL_NAMESPACE - { - namespace internal - { - inline const char* source_pointer( const char* source ) noexcept - { - return source; - } - - inline const char* source_pointer( const std::string& source ) noexcept - { - return source.c_str(); - } - - template< typename R, typename S > - struct minus - { - using analyze_t = typename R::analyze_t; // NOTE: S is currently ignored for analyze(). - - template< apply_mode A, - rewind_mode, - template< typename... > class Action, - template< typename... > class Control, - typename Input, - typename... States > - static bool match( Input& in, States&&... st ) - { - auto m = in.template mark< rewind_mode::REQUIRED >(); - - if( !Control< R >::template match< A, rewind_mode::ACTIVE, Action, Control >( in, st... ) ) { - return false; - } - memory_input< tracking_mode::LAZY, typename Input::eol_t, const char* > i2( m.iterator(), in.current(), source_pointer( in.source() ) ); - - if( !Control< S >::template match< apply_mode::NOTHING, rewind_mode::ACTIVE, Action, Control >( i2, st... ) ) { - return m( true ); - } - return m( !i2.empty() ); - } - }; - - template< typename R, typename S > - struct skip_control< minus< R, S > > : std::true_type - { - }; - - } // namespace internal - - } // namespace TAO_PEGTL_NAMESPACE - -} // namespace tao - -#endif diff --git a/thirdparty/PEGTL/include/tao/pegtl/internal/must.hpp b/thirdparty/PEGTL/include/tao/pegtl/internal/must.hpp old mode 100644 new mode 100755 index 9f37243..d6df55d --- a/thirdparty/PEGTL/include/tao/pegtl/internal/must.hpp +++ b/thirdparty/PEGTL/include/tao/pegtl/internal/must.hpp @@ -1,4 +1,4 @@ -// Copyright (c) 2014-2018 Dr. Colin Hirsch and Daniel Frey +// Copyright (c) 2014-2019 Dr. Colin Hirsch and Daniel Frey // Please see LICENSE for license or visit https://github.com/taocpp/PEGTL/ #ifndef TAO_PEGTL_INTERNAL_MUST_HPP @@ -27,12 +27,14 @@ namespace tao template< typename... Rules > struct must { - using analyze_t = analysis::generic< analysis::rule_type::SEQ, Rules... >; + using analyze_t = analysis::generic< analysis::rule_type::seq, Rules... >; template< apply_mode A, rewind_mode M, - template< typename... > class Action, - template< typename... > class Control, + template< typename... > + class Action, + template< typename... > + class Control, typename Input, typename... States > static bool match( Input& in, States&&... st ) @@ -52,14 +54,16 @@ namespace tao template< apply_mode A, rewind_mode, - template< typename... > class Action, - template< typename... > class Control, + template< typename... > + class Action, + template< typename... > + class Control, typename Input, typename... States > static bool match( Input& in, States&&... st ) { - if( !Control< Rule >::template match< A, rewind_mode::DONTCARE, Action, Control >( in, st... ) ) { - raise< Rule >::template match< A, rewind_mode::DONTCARE, Action, Control >( in, st... ); + if( !Control< Rule >::template match< A, rewind_mode::dontcare, Action, Control >( in, st... ) ) { + raise< Rule >::template match< A, rewind_mode::dontcare, Action, Control >( in, st... ); } return true; } diff --git a/thirdparty/PEGTL/include/tao/pegtl/internal/not_at.hpp b/thirdparty/PEGTL/include/tao/pegtl/internal/not_at.hpp old mode 100644 new mode 100755 index d479320..571bec7 --- a/thirdparty/PEGTL/include/tao/pegtl/internal/not_at.hpp +++ b/thirdparty/PEGTL/include/tao/pegtl/internal/not_at.hpp @@ -1,4 +1,4 @@ -// Copyright (c) 2014-2018 Dr. Colin Hirsch and Daniel Frey +// Copyright (c) 2014-2019 Dr. Colin Hirsch and Daniel Frey // Please see LICENSE for license or visit https://github.com/taocpp/PEGTL/ #ifndef TAO_PEGTL_INTERNAL_NOT_AT_HPP @@ -33,18 +33,20 @@ namespace tao template< typename... Rules > struct not_at { - using analyze_t = analysis::generic< analysis::rule_type::OPT, Rules... >; + using analyze_t = analysis::generic< analysis::rule_type::opt, Rules... >; template< apply_mode, rewind_mode, - template< typename... > class Action, - template< typename... > class Control, + template< typename... > + class Action, + template< typename... > + class Control, typename Input, typename... States > static bool match( Input& in, States&&... st ) { - const auto m = in.template mark< rewind_mode::REQUIRED >(); - return !rule_conjunction< Rules... >::template match< apply_mode::NOTHING, rewind_mode::ACTIVE, Action, Control >( in, st... ); + const auto m = in.template mark< rewind_mode::required >(); + return !rule_conjunction< Rules... >::template match< apply_mode::nothing, rewind_mode::active, Action, Control >( in, st... ); } }; diff --git a/thirdparty/PEGTL/include/tao/pegtl/internal/one.hpp b/thirdparty/PEGTL/include/tao/pegtl/internal/one.hpp old mode 100644 new mode 100755 index 8d29d51..f102d87 --- a/thirdparty/PEGTL/include/tao/pegtl/internal/one.hpp +++ b/thirdparty/PEGTL/include/tao/pegtl/internal/one.hpp @@ -1,4 +1,4 @@ -// Copyright (c) 2014-2018 Dr. Colin Hirsch and Daniel Frey +// Copyright (c) 2014-2019 Dr. Colin Hirsch and Daniel Frey // Please see LICENSE for license or visit https://github.com/taocpp/PEGTL/ #ifndef TAO_PEGTL_INTERNAL_ONE_HPP @@ -30,13 +30,14 @@ namespace tao template< result_on_found R, typename Peek, typename Peek::data_t... Cs > struct one { - using analyze_t = analysis::generic< analysis::rule_type::ANY >; + using analyze_t = analysis::generic< analysis::rule_type::any >; template< typename Input > - static bool match( Input& in ) noexcept( noexcept( in.empty() ) ) + static bool match( Input& in ) noexcept( noexcept( in.size( Peek::max_input_size ) ) ) { - if( !in.empty() ) { - if( const auto t = Peek::peek( in ) ) { + const std::size_t s = in.size( Peek::max_input_size ); + if( s >= Peek::min_input_size ) { + if( const auto t = Peek::peek( in, s ) ) { if( contains( t.data, { Cs... } ) == bool( R ) ) { bump_help< R, Input, typename Peek::data_t, Cs... >( in, t.size ); return true; @@ -50,13 +51,14 @@ namespace tao template< result_on_found R, typename Peek, typename Peek::data_t C > struct one< R, Peek, C > { - using analyze_t = analysis::generic< analysis::rule_type::ANY >; + using analyze_t = analysis::generic< analysis::rule_type::any >; template< typename Input > - static bool match( Input& in ) noexcept( noexcept( in.empty() ) ) + static bool match( Input& in ) noexcept( noexcept( in.size( Peek::max_input_size ) ) ) { - if( !in.empty() ) { - if( const auto t = Peek::peek( in ) ) { + const std::size_t s = in.size( Peek::max_input_size ); + if( s >= Peek::min_input_size ) { + if( const auto t = Peek::peek( in, s ) ) { if( ( t.data == C ) == bool( R ) ) { bump_help< R, Input, typename Peek::data_t, C >( in, t.size ); return true; diff --git a/thirdparty/PEGTL/include/tao/pegtl/internal/opt.hpp b/thirdparty/PEGTL/include/tao/pegtl/internal/opt.hpp old mode 100644 new mode 100755 index f27046a..c374602 --- a/thirdparty/PEGTL/include/tao/pegtl/internal/opt.hpp +++ b/thirdparty/PEGTL/include/tao/pegtl/internal/opt.hpp @@ -1,4 +1,4 @@ -// Copyright (c) 2014-2018 Dr. Colin Hirsch and Daniel Frey +// Copyright (c) 2014-2019 Dr. Colin Hirsch and Daniel Frey // Please see LICENSE for license or visit https://github.com/taocpp/PEGTL/ #ifndef TAO_PEGTL_INTERNAL_OPT_HPP @@ -36,17 +36,19 @@ namespace tao template< typename... Rules > struct opt { - using analyze_t = analysis::generic< analysis::rule_type::OPT, Rules... >; + using analyze_t = analysis::generic< analysis::rule_type::opt, Rules... >; template< apply_mode A, rewind_mode, - template< typename... > class Action, - template< typename... > class Control, + template< typename... > + class Action, + template< typename... > + class Control, typename Input, typename... States > static bool match( Input& in, States&&... st ) { - duseltronik< seq< Rules... >, A, rewind_mode::REQUIRED, Action, Control >::match( in, st... ); + duseltronik< seq< Rules... >, A, rewind_mode::required, Action, Control >::match( in, st... ); return true; } }; diff --git a/thirdparty/PEGTL/include/tao/pegtl/internal/pad.hpp b/thirdparty/PEGTL/include/tao/pegtl/internal/pad.hpp old mode 100644 new mode 100755 index 8aa586d..4e57de8 --- a/thirdparty/PEGTL/include/tao/pegtl/internal/pad.hpp +++ b/thirdparty/PEGTL/include/tao/pegtl/internal/pad.hpp @@ -1,4 +1,4 @@ -// Copyright (c) 2014-2018 Dr. Colin Hirsch and Daniel Frey +// Copyright (c) 2014-2019 Dr. Colin Hirsch and Daniel Frey // Please see LICENSE for license or visit https://github.com/taocpp/PEGTL/ #ifndef TAO_PEGTL_INTERNAL_PAD_HPP diff --git a/thirdparty/PEGTL/include/tao/pegtl/internal/pad_opt.hpp b/thirdparty/PEGTL/include/tao/pegtl/internal/pad_opt.hpp old mode 100644 new mode 100755 index bdd0f66..777bf33 --- a/thirdparty/PEGTL/include/tao/pegtl/internal/pad_opt.hpp +++ b/thirdparty/PEGTL/include/tao/pegtl/internal/pad_opt.hpp @@ -1,4 +1,4 @@ -// Copyright (c) 2014-2018 Dr. Colin Hirsch and Daniel Frey +// Copyright (c) 2014-2019 Dr. Colin Hirsch and Daniel Frey // Please see LICENSE for license or visit https://github.com/taocpp/PEGTL/ #ifndef TAO_PEGTL_INTERNAL_PAD_OPT_HPP diff --git a/thirdparty/PEGTL/include/tao/pegtl/internal/peek_char.hpp b/thirdparty/PEGTL/include/tao/pegtl/internal/peek_char.hpp old mode 100644 new mode 100755 index f7eaf90..4c5d0a6 --- a/thirdparty/PEGTL/include/tao/pegtl/internal/peek_char.hpp +++ b/thirdparty/PEGTL/include/tao/pegtl/internal/peek_char.hpp @@ -1,4 +1,4 @@ -// Copyright (c) 2014-2018 Dr. Colin Hirsch and Daniel Frey +// Copyright (c) 2014-2019 Dr. Colin Hirsch and Daniel Frey // Please see LICENSE for license or visit https://github.com/taocpp/PEGTL/ #ifndef TAO_PEGTL_INTERNAL_PEEK_CHAR_HPP @@ -21,10 +21,13 @@ namespace tao using data_t = char; using pair_t = input_pair< char >; + static constexpr std::size_t min_input_size = 1; + static constexpr std::size_t max_input_size = 1; + template< typename Input > - static pair_t peek( Input& in, const std::size_t o = 0 ) noexcept( noexcept( in.Input::peek_char( 0 ) ) ) + static pair_t peek( const Input& in, const std::size_t /*unused*/ = 1 ) noexcept { - return { in.peek_char( o ), 1 }; + return { in.peek_char(), 1 }; } }; diff --git a/thirdparty/PEGTL/include/tao/pegtl/internal/peek_mask_uint.hpp b/thirdparty/PEGTL/include/tao/pegtl/internal/peek_mask_uint.hpp old mode 100644 new mode 100755 index b5709d6..426946c --- a/thirdparty/PEGTL/include/tao/pegtl/internal/peek_mask_uint.hpp +++ b/thirdparty/PEGTL/include/tao/pegtl/internal/peek_mask_uint.hpp @@ -1,4 +1,4 @@ -// Copyright (c) 2018 Dr. Colin Hirsch and Daniel Frey +// Copyright (c) 2018-2019 Dr. Colin Hirsch and Daniel Frey // Please see LICENSE for license or visit https://github.com/taocpp/PEGTL/ #ifndef TAO_PEGTL_INTERNAL_PEEK_MASK_UINT_HPP @@ -24,15 +24,14 @@ namespace tao using data_t = typename R::type; using pair_t = input_pair< data_t >; + static constexpr std::size_t min_input_size = sizeof( data_t ); + static constexpr std::size_t max_input_size = sizeof( data_t ); + template< typename Input > - static pair_t peek( Input& in ) noexcept( noexcept( in.size( sizeof( data_t ) ) ) ) + static pair_t peek( const Input& in, const std::size_t /*unused*/ ) noexcept { - const std::size_t s = in.size( sizeof( data_t ) ); - if( s >= sizeof( data_t ) ) { - const data_t data = R::read( in.current() ) & M; - return { data, sizeof( data_t ) }; - } - return { 0, 0 }; + const data_t data = R::read( in.current() ) & M; + return { data, sizeof( data_t ) }; } }; diff --git a/thirdparty/PEGTL/include/tao/pegtl/internal/peek_mask_uint8.hpp b/thirdparty/PEGTL/include/tao/pegtl/internal/peek_mask_uint8.hpp old mode 100644 new mode 100755 index 8711918..fb6f4cf --- a/thirdparty/PEGTL/include/tao/pegtl/internal/peek_mask_uint8.hpp +++ b/thirdparty/PEGTL/include/tao/pegtl/internal/peek_mask_uint8.hpp @@ -1,4 +1,4 @@ -// Copyright (c) 2018 Dr. Colin Hirsch and Daniel Frey +// Copyright (c) 2018-2019 Dr. Colin Hirsch and Daniel Frey // Please see LICENSE for license or visit https://github.com/taocpp/PEGTL/ #ifndef TAO_PEGTL_INTERNAL_PEEK_MASK_UINT8_HPP @@ -23,10 +23,13 @@ namespace tao using data_t = std::uint8_t; using pair_t = input_pair< std::uint8_t >; + static constexpr std::size_t min_input_size = 1; + static constexpr std::size_t max_input_size = 1; + template< typename Input > - static pair_t peek( Input& in, const std::size_t o = 0 ) noexcept( noexcept( in.peek_byte( 0 ) ) ) + static pair_t peek( const Input& in, const std::size_t /*unused*/ = 1 ) noexcept { - return { std::uint8_t( in.peek_byte( o ) & M ), 1 }; + return { std::uint8_t( in.peek_uint8() & M ), 1 }; } }; diff --git a/thirdparty/PEGTL/include/tao/pegtl/internal/peek_uint.hpp b/thirdparty/PEGTL/include/tao/pegtl/internal/peek_uint.hpp old mode 100644 new mode 100755 index 4a0fd89..a7b04a6 --- a/thirdparty/PEGTL/include/tao/pegtl/internal/peek_uint.hpp +++ b/thirdparty/PEGTL/include/tao/pegtl/internal/peek_uint.hpp @@ -1,4 +1,4 @@ -// Copyright (c) 2018 Dr. Colin Hirsch and Daniel Frey +// Copyright (c) 2018-2019 Dr. Colin Hirsch and Daniel Frey // Please see LICENSE for license or visit https://github.com/taocpp/PEGTL/ #ifndef TAO_PEGTL_INTERNAL_PEEK_UINT_HPP @@ -24,15 +24,14 @@ namespace tao using data_t = typename R::type; using pair_t = input_pair< data_t >; + static constexpr std::size_t min_input_size = sizeof( data_t ); + static constexpr std::size_t max_input_size = sizeof( data_t ); + template< typename Input > - static pair_t peek( Input& in ) noexcept( noexcept( in.size( sizeof( data_t ) ) ) ) + static pair_t peek( const Input& in, const std::size_t /*unused*/ ) noexcept { - const std::size_t s = in.size( sizeof( data_t ) ); - if( s >= sizeof( data_t ) ) { - const data_t data = R::read( in.current() ); - return { data, sizeof( data_t ) }; - } - return { 0, 0 }; + const data_t data = R::read( in.current() ); + return { data, sizeof( data_t ) }; } }; diff --git a/thirdparty/PEGTL/include/tao/pegtl/internal/peek_uint8.hpp b/thirdparty/PEGTL/include/tao/pegtl/internal/peek_uint8.hpp old mode 100644 new mode 100755 index aebe1b2..af0589e --- a/thirdparty/PEGTL/include/tao/pegtl/internal/peek_uint8.hpp +++ b/thirdparty/PEGTL/include/tao/pegtl/internal/peek_uint8.hpp @@ -1,4 +1,4 @@ -// Copyright (c) 2018 Dr. Colin Hirsch and Daniel Frey +// Copyright (c) 2018-2019 Dr. Colin Hirsch and Daniel Frey // Please see LICENSE for license or visit https://github.com/taocpp/PEGTL/ #ifndef TAO_PEGTL_INTERNAL_PEEK_UINT8_HPP @@ -22,10 +22,13 @@ namespace tao using data_t = std::uint8_t; using pair_t = input_pair< std::uint8_t >; + static constexpr std::size_t min_input_size = 1; + static constexpr std::size_t max_input_size = 1; + template< typename Input > - static pair_t peek( Input& in, const std::size_t o = 0 ) noexcept( noexcept( in.peek_byte( 0 ) ) ) + static pair_t peek( const Input& in, const std::size_t /*unused*/ = 1 ) noexcept { - return { in.peek_byte( o ), 1 }; + return { in.peek_uint8(), 1 }; } }; diff --git a/thirdparty/PEGTL/include/tao/pegtl/internal/peek_utf16.hpp b/thirdparty/PEGTL/include/tao/pegtl/internal/peek_utf16.hpp old mode 100644 new mode 100755 index 8d88e42..e5cb267 --- a/thirdparty/PEGTL/include/tao/pegtl/internal/peek_utf16.hpp +++ b/thirdparty/PEGTL/include/tao/pegtl/internal/peek_utf16.hpp @@ -1,4 +1,4 @@ -// Copyright (c) 2014-2018 Dr. Colin Hirsch and Daniel Frey +// Copyright (c) 2014-2019 Dr. Colin Hirsch and Daniel Frey // Please see LICENSE for license or visit https://github.com/taocpp/PEGTL/ #ifndef TAO_PEGTL_INTERNAL_PEEK_UTF16_HPP @@ -28,13 +28,12 @@ namespace tao static_assert( sizeof( short_t ) == 2, "expected size 2 for 16bit value" ); static_assert( sizeof( char16_t ) == 2, "expected size 2 for 16bit value" ); + static constexpr std::size_t min_input_size = 2; + static constexpr std::size_t max_input_size = 4; + template< typename Input > - static pair_t peek( Input& in ) noexcept( noexcept( in.size( 4 ) ) ) + static pair_t peek( const Input& in, const std::size_t s ) noexcept { - const std::size_t s = in.size( 4 ); - if( s < 2 ) { - return { 0, 0 }; - } const char32_t t = R::read( in.current() ); if( ( t < 0xd800 ) || ( t > 0xdfff ) ) { return { t, 2 }; diff --git a/thirdparty/PEGTL/include/tao/pegtl/internal/peek_utf32.hpp b/thirdparty/PEGTL/include/tao/pegtl/internal/peek_utf32.hpp old mode 100644 new mode 100755 index 7d720b1..23dd9bf --- a/thirdparty/PEGTL/include/tao/pegtl/internal/peek_utf32.hpp +++ b/thirdparty/PEGTL/include/tao/pegtl/internal/peek_utf32.hpp @@ -1,4 +1,4 @@ -// Copyright (c) 2014-2018 Dr. Colin Hirsch and Daniel Frey +// Copyright (c) 2014-2019 Dr. Colin Hirsch and Daniel Frey // Please see LICENSE for license or visit https://github.com/taocpp/PEGTL/ #ifndef TAO_PEGTL_INTERNAL_PEEK_UTF32_HPP @@ -25,15 +25,15 @@ namespace tao static_assert( sizeof( char32_t ) == 4, "expected size 4 for 32bit value" ); + static constexpr std::size_t min_input_size = 4; + static constexpr std::size_t max_input_size = 4; + template< typename Input > - static pair_t peek( Input& in ) noexcept( noexcept( in.size( 4 ) ) ) + static pair_t peek( const Input& in, const std::size_t /*unused*/ ) noexcept { - const std::size_t s = in.size( 4 ); - if( s >= 4 ) { - const char32_t t = R::read( in.current() ); - if( ( 0 <= t ) && ( t <= 0x10ffff ) && !( t >= 0xd800 && t <= 0xdfff ) ) { - return { t, 4 }; - } + const char32_t t = R::read( in.current() ); + if( ( t <= 0x10ffff ) && !( t >= 0xd800 && t <= 0xdfff ) ) { + return { t, 4 }; } return { 0, 0 }; } diff --git a/thirdparty/PEGTL/include/tao/pegtl/internal/peek_utf8.hpp b/thirdparty/PEGTL/include/tao/pegtl/internal/peek_utf8.hpp old mode 100644 new mode 100755 index 2b11f75..9c825da --- a/thirdparty/PEGTL/include/tao/pegtl/internal/peek_utf8.hpp +++ b/thirdparty/PEGTL/include/tao/pegtl/internal/peek_utf8.hpp @@ -1,4 +1,4 @@ -// Copyright (c) 2014-2018 Dr. Colin Hirsch and Daniel Frey +// Copyright (c) 2014-2019 Dr. Colin Hirsch and Daniel Frey // Please see LICENSE for license or visit https://github.com/taocpp/PEGTL/ #ifndef TAO_PEGTL_INTERNAL_PEEK_UTF8_HPP @@ -19,17 +19,27 @@ namespace tao using data_t = char32_t; using pair_t = input_pair< char32_t >; + static constexpr std::size_t min_input_size = 1; + static constexpr std::size_t max_input_size = 4; + template< typename Input > - static pair_t peek( Input& in ) noexcept( noexcept( in.size( 4 ) ) ) + static pair_t peek( const Input& in, const std::size_t s ) noexcept { - char32_t c0 = in.peek_byte(); + char32_t c0 = in.peek_uint8(); if( ( c0 & 0x80 ) == 0 ) { return { c0, 1 }; } + return peek_impl( in, c0, s ); + } + + private: + template< typename Input > + static pair_t peek_impl( const Input& in, char32_t c0, const std::size_t s ) noexcept + { if( ( c0 & 0xE0 ) == 0xC0 ) { - if( in.size( 2 ) >= 2 ) { - const char32_t c1 = in.peek_byte( 1 ); + if( s >= 2 ) { + const char32_t c1 = in.peek_uint8( 1 ); if( ( c1 & 0xC0 ) == 0x80 ) { c0 &= 0x1F; c0 <<= 6; @@ -41,9 +51,9 @@ namespace tao } } else if( ( c0 & 0xF0 ) == 0xE0 ) { - if( in.size( 3 ) >= 3 ) { - const char32_t c1 = in.peek_byte( 1 ); - const char32_t c2 = in.peek_byte( 2 ); + if( s >= 3 ) { + const char32_t c1 = in.peek_uint8( 1 ); + const char32_t c2 = in.peek_uint8( 2 ); if( ( ( c1 & 0xC0 ) == 0x80 ) && ( ( c2 & 0xC0 ) == 0x80 ) ) { c0 &= 0x0F; c0 <<= 6; @@ -57,10 +67,10 @@ namespace tao } } else if( ( c0 & 0xF8 ) == 0xF0 ) { - if( in.size( 4 ) >= 4 ) { - const char32_t c1 = in.peek_byte( 1 ); - const char32_t c2 = in.peek_byte( 2 ); - const char32_t c3 = in.peek_byte( 3 ); + if( s >= 4 ) { + const char32_t c1 = in.peek_uint8( 1 ); + const char32_t c2 = in.peek_uint8( 2 ); + const char32_t c3 = in.peek_uint8( 3 ); if( ( ( c1 & 0xC0 ) == 0x80 ) && ( ( c2 & 0xC0 ) == 0x80 ) && ( ( c3 & 0xC0 ) == 0x80 ) ) { c0 &= 0x07; c0 <<= 6; diff --git a/thirdparty/PEGTL/include/tao/pegtl/internal/pegtl_string.hpp b/thirdparty/PEGTL/include/tao/pegtl/internal/pegtl_string.hpp old mode 100644 new mode 100755 index 5928d73..fdddb58 --- a/thirdparty/PEGTL/include/tao/pegtl/internal/pegtl_string.hpp +++ b/thirdparty/PEGTL/include/tao/pegtl/internal/pegtl_string.hpp @@ -1,4 +1,4 @@ -// Copyright (c) 2015-2018 Dr. Colin Hirsch and Daniel Frey +// Copyright (c) 2015-2019 Dr. Colin Hirsch and Daniel Frey // Please see LICENSE for license or visit https://github.com/taocpp/PEGTL/ #ifndef TAO_PEGTL_INTERNAL_PEGTL_STRING_HPP @@ -95,7 +95,7 @@ namespace tao #define TAO_PEGTL_KEYWORD( x ) \ TAO_PEGTL_INTERNAL_STRING( tao::TAO_PEGTL_NAMESPACE::ascii::keyword, x ) -// Compatibility, remove with 3.0 +// Compatibility, remove with 3.0.0 #define TAOCPP_PEGTL_STRING( x ) TAO_PEGTL_STRING( x ) #define TAOCPP_PEGTL_ISTRING( x ) TAO_PEGTL_ISTRING( x ) #define TAOCPP_PEGTL_KEYWORD( x ) TAO_PEGTL_KEYWORD( x ) diff --git a/thirdparty/PEGTL/include/tao/pegtl/internal/plus.hpp b/thirdparty/PEGTL/include/tao/pegtl/internal/plus.hpp old mode 100644 new mode 100755 index 5ebd23b..cb50441 --- a/thirdparty/PEGTL/include/tao/pegtl/internal/plus.hpp +++ b/thirdparty/PEGTL/include/tao/pegtl/internal/plus.hpp @@ -1,4 +1,4 @@ -// Copyright (c) 2014-2018 Dr. Colin Hirsch and Daniel Frey +// Copyright (c) 2014-2019 Dr. Colin Hirsch and Daniel Frey // Please see LICENSE for license or visit https://github.com/taocpp/PEGTL/ #ifndef TAO_PEGTL_INTERNAL_PLUS_HPP @@ -33,12 +33,14 @@ namespace tao template< typename Rule, typename... Rules > struct plus { - using analyze_t = analysis::generic< analysis::rule_type::SEQ, Rule, Rules..., opt< plus > >; + using analyze_t = analysis::generic< analysis::rule_type::seq, Rule, Rules..., opt< plus > >; template< apply_mode A, rewind_mode M, - template< typename... > class Action, - template< typename... > class Control, + template< typename... > + class Action, + template< typename... > + class Control, typename Input, typename... States > static bool match( Input& in, States&&... st ) diff --git a/thirdparty/PEGTL/include/tao/pegtl/internal/raise.hpp b/thirdparty/PEGTL/include/tao/pegtl/internal/raise.hpp old mode 100644 new mode 100755 index 7a76dd2..76825a0 --- a/thirdparty/PEGTL/include/tao/pegtl/internal/raise.hpp +++ b/thirdparty/PEGTL/include/tao/pegtl/internal/raise.hpp @@ -1,4 +1,4 @@ -// Copyright (c) 2014-2018 Dr. Colin Hirsch and Daniel Frey +// Copyright (c) 2014-2019 Dr. Colin Hirsch and Daniel Frey // Please see LICENSE for license or visit https://github.com/taocpp/PEGTL/ #ifndef TAO_PEGTL_INTERNAL_RAISE_HPP @@ -25,7 +25,7 @@ namespace tao template< typename T > struct raise { - using analyze_t = analysis::generic< analysis::rule_type::ANY >; + using analyze_t = analysis::generic< analysis::rule_type::any >; #ifdef _MSC_VER #pragma warning( push ) @@ -33,8 +33,10 @@ namespace tao #endif template< apply_mode, rewind_mode, - template< typename... > class Action, - template< typename... > class Control, + template< typename... > + class Action, + template< typename... > + class Control, typename Input, typename... States > static bool match( Input& in, States&&... st ) diff --git a/thirdparty/PEGTL/include/tao/pegtl/internal/range.hpp b/thirdparty/PEGTL/include/tao/pegtl/internal/range.hpp old mode 100644 new mode 100755 index 3964463..4b24a17 --- a/thirdparty/PEGTL/include/tao/pegtl/internal/range.hpp +++ b/thirdparty/PEGTL/include/tao/pegtl/internal/range.hpp @@ -1,4 +1,4 @@ -// Copyright (c) 2014-2018 Dr. Colin Hirsch and Daniel Frey +// Copyright (c) 2014-2019 Dr. Colin Hirsch and Daniel Frey // Please see LICENSE for license or visit https://github.com/taocpp/PEGTL/ #ifndef TAO_PEGTL_INTERNAL_RANGE_HPP @@ -23,7 +23,7 @@ namespace tao { static_assert( Lo <= Hi, "invalid range detected" ); - using analyze_t = analysis::generic< analysis::rule_type::ANY >; + using analyze_t = analysis::generic< analysis::rule_type::any >; template< int Eol > struct can_match_eol @@ -32,10 +32,11 @@ namespace tao }; template< typename Input > - static bool match( Input& in ) + static bool match( Input& in ) noexcept( noexcept( in.size( Peek::max_input_size ) ) ) { - if( !in.empty() ) { - if( const auto t = Peek::peek( in ) ) { + const std::size_t s = in.size( Peek::max_input_size ); + if( s >= Peek::min_input_size ) { + if( const auto t = Peek::peek( in, s ) ) { if( ( ( Lo <= t.data ) && ( t.data <= Hi ) ) == bool( R ) ) { bump_impl< can_match_eol< Input::eol_t::ch >::value >::bump( in, t.size ); return true; diff --git a/thirdparty/PEGTL/include/tao/pegtl/internal/ranges.hpp b/thirdparty/PEGTL/include/tao/pegtl/internal/ranges.hpp old mode 100644 new mode 100755 index d91f433..00aa6c8 --- a/thirdparty/PEGTL/include/tao/pegtl/internal/ranges.hpp +++ b/thirdparty/PEGTL/include/tao/pegtl/internal/ranges.hpp @@ -1,4 +1,4 @@ -// Copyright (c) 2014-2018 Dr. Colin Hirsch and Daniel Frey +// Copyright (c) 2014-2019 Dr. Colin Hirsch and Daniel Frey // Please see LICENSE for license or visit https://github.com/taocpp/PEGTL/ #ifndef TAO_PEGTL_INTERNAL_RANGES_HPP @@ -59,7 +59,7 @@ namespace tao template< typename Peek, typename Peek::data_t... Cs > struct ranges { - using analyze_t = analysis::generic< analysis::rule_type::ANY >; + using analyze_t = analysis::generic< analysis::rule_type::any >; template< int Eol > struct can_match_eol @@ -68,10 +68,11 @@ namespace tao }; template< typename Input > - static bool match( Input& in ) + static bool match( Input& in ) noexcept( noexcept( in.size( Peek::max_input_size ) ) ) { - if( !in.empty() ) { - if( const auto t = Peek::peek( in ) ) { + const std::size_t s = in.size( Peek::max_input_size ); + if( s >= Peek::min_input_size ) { + if( const auto t = Peek::peek( in, s ) ) { if( ranges_impl< Input::eol_t::ch, typename Peek::data_t, Cs... >::match( t.data ) ) { bump_impl< can_match_eol< Input::eol_t::ch >::value >::bump( in, t.size ); return true; @@ -84,7 +85,7 @@ namespace tao template< typename Peek, typename Peek::data_t Lo, typename Peek::data_t Hi > struct ranges< Peek, Lo, Hi > - : range< result_on_found::SUCCESS, Peek, Lo, Hi > + : range< result_on_found::success, Peek, Lo, Hi > { }; diff --git a/thirdparty/PEGTL/include/tao/pegtl/internal/read_uint.hpp b/thirdparty/PEGTL/include/tao/pegtl/internal/read_uint.hpp old mode 100644 new mode 100755 index 6e9d3ae..d5dcd39 --- a/thirdparty/PEGTL/include/tao/pegtl/internal/read_uint.hpp +++ b/thirdparty/PEGTL/include/tao/pegtl/internal/read_uint.hpp @@ -1,4 +1,4 @@ -// Copyright (c) 2018 Dr. Colin Hirsch and Daniel Frey +// Copyright (c) 2018-2019 Dr. Colin Hirsch and Daniel Frey // Please see LICENSE for license or visit https://github.com/taocpp/PEGTL/ #ifndef TAO_PEGTL_INTERNAL_READ_UINT_HPP diff --git a/thirdparty/PEGTL/include/tao/pegtl/internal/rematch.hpp b/thirdparty/PEGTL/include/tao/pegtl/internal/rematch.hpp new file mode 100755 index 0000000..ba43ec0 --- /dev/null +++ b/thirdparty/PEGTL/include/tao/pegtl/internal/rematch.hpp @@ -0,0 +1,86 @@ +// Copyright (c) 2019 Dr. Colin Hirsch and Daniel Frey +// Please see LICENSE for license or visit https://github.com/taocpp/PEGTL/ + +#ifndef TAO_PEGTL_INTERNAL_REMATCH_HPP +#define TAO_PEGTL_INTERNAL_REMATCH_HPP + +#include "../config.hpp" + +#include "skip_control.hpp" + +#include "../apply_mode.hpp" +#include "../memory_input.hpp" +#include "../rewind_mode.hpp" + +namespace tao +{ + namespace TAO_PEGTL_NAMESPACE + { + namespace internal + { + template< typename Head, typename... Rules > + struct rematch; + + template< typename Head > + struct rematch< Head > + { + using analyze_t = typename Head::analyze_t; + + template< apply_mode A, + rewind_mode M, + template< typename... > + class Action, + template< typename... > + class Control, + typename Input, + typename... States > + static bool match( Input& in, States&&... st ) + { + return Control< Head >::template match< A, M, Action, Control >( in, st... ); + } + }; + + template< typename Head, typename Rule, typename... Rules > + struct rematch< Head, Rule, Rules... > + { + using analyze_t = typename Head::analyze_t; // NOTE: Rule and Rules are ignored for analyze(). + + template< apply_mode A, + rewind_mode, + template< typename... > + class Action, + template< typename... > + class Control, + typename Input, + typename... States > + static bool match( Input& in, States&&... st ) + { + auto m = in.template mark< rewind_mode::required >(); + + if( Control< Head >::template match< A, rewind_mode::active, Action, Control >( in, st... ) ) { + memory_input< Input::tracking_mode_v, typename Input::eol_t, typename Input::source_t > i2( m.iterator(), in.current(), in.source() ); +#ifdef __cpp_fold_expressions + return m( ( Control< Rule >::template match< A, rewind_mode::active, Action, Control >( i2, st... ) && ... && ( i2.restart( m ), Control< Rules >::template match< A, rewind_mode::active, Action, Control >( i2, st... ) ) ) ); +#else + bool result = Control< Rule >::template match< A, rewind_mode::active, Action, Control >( i2, st... ); + using swallow = bool[]; + (void)swallow{ result = result && ( i2.restart( m ), Control< Rules >::template match< A, rewind_mode::active, Action, Control >( i2, st... ) )..., true }; + return m( result ); +#endif + } + return false; + } + }; + + template< typename Head, typename... Rules > + struct skip_control< rematch< Head, Rules... > > : std::true_type + { + }; + + } // namespace internal + + } // namespace TAO_PEGTL_NAMESPACE + +} // namespace tao + +#endif diff --git a/thirdparty/PEGTL/include/tao/pegtl/internal/rep.hpp b/thirdparty/PEGTL/include/tao/pegtl/internal/rep.hpp old mode 100644 new mode 100755 index 1e7e600..e15960e --- a/thirdparty/PEGTL/include/tao/pegtl/internal/rep.hpp +++ b/thirdparty/PEGTL/include/tao/pegtl/internal/rep.hpp @@ -1,4 +1,4 @@ -// Copyright (c) 2014-2018 Dr. Colin Hirsch and Daniel Frey +// Copyright (c) 2014-2019 Dr. Colin Hirsch and Daniel Frey // Please see LICENSE for license or visit https://github.com/taocpp/PEGTL/ #ifndef TAO_PEGTL_INTERNAL_REP_HPP @@ -39,12 +39,14 @@ namespace tao template< unsigned Num, typename... Rules > struct rep { - using analyze_t = analysis::counted< analysis::rule_type::SEQ, Num, Rules... >; + using analyze_t = analysis::counted< analysis::rule_type::seq, Num, Rules... >; template< apply_mode A, rewind_mode M, - template< typename... > class Action, - template< typename... > class Control, + template< typename... > + class Action, + template< typename... > + class Control, typename Input, typename... States > static bool match( Input& in, States&&... st ) diff --git a/thirdparty/PEGTL/include/tao/pegtl/internal/rep_min.hpp b/thirdparty/PEGTL/include/tao/pegtl/internal/rep_min.hpp old mode 100644 new mode 100755 index f48b542..9e0d438 --- a/thirdparty/PEGTL/include/tao/pegtl/internal/rep_min.hpp +++ b/thirdparty/PEGTL/include/tao/pegtl/internal/rep_min.hpp @@ -1,4 +1,4 @@ -// Copyright (c) 2014-2018 Dr. Colin Hirsch and Daniel Frey +// Copyright (c) 2014-2019 Dr. Colin Hirsch and Daniel Frey // Please see LICENSE for license or visit https://github.com/taocpp/PEGTL/ #ifndef TAO_PEGTL_INTERNAL_REP_MIN_HPP diff --git a/thirdparty/PEGTL/include/tao/pegtl/internal/rep_min_max.hpp b/thirdparty/PEGTL/include/tao/pegtl/internal/rep_min_max.hpp old mode 100644 new mode 100755 index d50a47f..4c8af53 --- a/thirdparty/PEGTL/include/tao/pegtl/internal/rep_min_max.hpp +++ b/thirdparty/PEGTL/include/tao/pegtl/internal/rep_min_max.hpp @@ -1,4 +1,4 @@ -// Copyright (c) 2014-2018 Dr. Colin Hirsch and Daniel Frey +// Copyright (c) 2014-2019 Dr. Colin Hirsch and Daniel Frey // Please see LICENSE for license or visit https://github.com/taocpp/PEGTL/ #ifndef TAO_PEGTL_INTERNAL_REP_MIN_MAX_HPP @@ -45,14 +45,16 @@ namespace tao template< unsigned Min, unsigned Max, typename... Rules > struct rep_min_max { - using analyze_t = analysis::counted< analysis::rule_type::SEQ, Min, Rules... >; + using analyze_t = analysis::counted< analysis::rule_type::seq, Min, Rules... >; static_assert( Min <= Max, "invalid rep_min_max rule (maximum number of repetitions smaller than minimum)" ); template< apply_mode A, rewind_mode M, - template< typename... > class Action, - template< typename... > class Control, + template< typename... > + class Action, + template< typename... > + class Control, typename Input, typename... States > static bool match( Input& in, States&&... st ) @@ -66,7 +68,7 @@ namespace tao } } for( unsigned i = Min; i != Max; ++i ) { - if( !duseltronik< seq< Rules... >, A, rewind_mode::REQUIRED, Action, Control >::match( in, st... ) ) { + if( !duseltronik< seq< Rules... >, A, rewind_mode::required, Action, Control >::match( in, st... ) ) { return m( true ); } } diff --git a/thirdparty/PEGTL/include/tao/pegtl/internal/rep_opt.hpp b/thirdparty/PEGTL/include/tao/pegtl/internal/rep_opt.hpp old mode 100644 new mode 100755 index 3553f89..317aeaa --- a/thirdparty/PEGTL/include/tao/pegtl/internal/rep_opt.hpp +++ b/thirdparty/PEGTL/include/tao/pegtl/internal/rep_opt.hpp @@ -1,4 +1,4 @@ -// Copyright (c) 2014-2018 Dr. Colin Hirsch and Daniel Frey +// Copyright (c) 2014-2019 Dr. Colin Hirsch and Daniel Frey // Please see LICENSE for license or visit https://github.com/taocpp/PEGTL/ #ifndef TAO_PEGTL_INTERNAL_REP_OPT_HPP @@ -24,17 +24,19 @@ namespace tao template< unsigned Max, typename... Rules > struct rep_opt { - using analyze_t = analysis::generic< analysis::rule_type::OPT, Rules... >; + using analyze_t = analysis::generic< analysis::rule_type::opt, Rules... >; template< apply_mode A, rewind_mode, - template< typename... > class Action, - template< typename... > class Control, + template< typename... > + class Action, + template< typename... > + class Control, typename Input, typename... States > static bool match( Input& in, States&&... st ) { - for( unsigned i = 0; ( i != Max ) && duseltronik< seq< Rules... >, A, rewind_mode::REQUIRED, Action, Control >::match( in, st... ); ++i ) { + for( unsigned i = 0; ( i != Max ) && duseltronik< seq< Rules... >, A, rewind_mode::required, Action, Control >::match( in, st... ); ++i ) { } return true; } diff --git a/thirdparty/PEGTL/include/tao/pegtl/internal/require.hpp b/thirdparty/PEGTL/include/tao/pegtl/internal/require.hpp old mode 100644 new mode 100755 index f03821e..0821cdb --- a/thirdparty/PEGTL/include/tao/pegtl/internal/require.hpp +++ b/thirdparty/PEGTL/include/tao/pegtl/internal/require.hpp @@ -1,4 +1,4 @@ -// Copyright (c) 2016-2018 Dr. Colin Hirsch and Daniel Frey +// Copyright (c) 2016-2019 Dr. Colin Hirsch and Daniel Frey // Please see LICENSE for license or visit https://github.com/taocpp/PEGTL/ #ifndef TAO_PEGTL_INTERNAL_REQUIRE_HPP @@ -29,7 +29,7 @@ namespace tao template< unsigned Amount > struct require { - using analyze_t = analysis::generic< analysis::rule_type::OPT >; + using analyze_t = analysis::generic< analysis::rule_type::opt >; template< typename Input > static bool match( Input& in ) noexcept( noexcept( in.size( 0 ) ) ) diff --git a/thirdparty/PEGTL/include/tao/pegtl/internal/result_on_found.hpp b/thirdparty/PEGTL/include/tao/pegtl/internal/result_on_found.hpp old mode 100644 new mode 100755 index 13ec989..84cda22 --- a/thirdparty/PEGTL/include/tao/pegtl/internal/result_on_found.hpp +++ b/thirdparty/PEGTL/include/tao/pegtl/internal/result_on_found.hpp @@ -1,4 +1,4 @@ -// Copyright (c) 2014-2018 Dr. Colin Hirsch and Daniel Frey +// Copyright (c) 2014-2019 Dr. Colin Hirsch and Daniel Frey // Please see LICENSE for license or visit https://github.com/taocpp/PEGTL/ #ifndef TAO_PEGTL_INTERNAL_RESULT_ON_FOUND_HPP @@ -14,8 +14,8 @@ namespace tao { enum class result_on_found : bool { - SUCCESS = true, - FAILURE = false + success = true, + failure = false, }; } // namespace internal diff --git a/thirdparty/PEGTL/include/tao/pegtl/internal/rule_conjunction.hpp b/thirdparty/PEGTL/include/tao/pegtl/internal/rule_conjunction.hpp old mode 100644 new mode 100755 index d4dd3d1..bc12295 --- a/thirdparty/PEGTL/include/tao/pegtl/internal/rule_conjunction.hpp +++ b/thirdparty/PEGTL/include/tao/pegtl/internal/rule_conjunction.hpp @@ -1,4 +1,4 @@ -// Copyright (c) 2014-2018 Dr. Colin Hirsch and Daniel Frey +// Copyright (c) 2014-2019 Dr. Colin Hirsch and Daniel Frey // Please see LICENSE for license or visit https://github.com/taocpp/PEGTL/ #ifndef TAO_PEGTL_INTERNAL_RULE_CONJUNCTION_HPP @@ -22,8 +22,10 @@ namespace tao { template< apply_mode A, rewind_mode M, - template< typename... > class Action, - template< typename... > class Control, + template< typename... > + class Action, + template< typename... > + class Control, typename Input, typename... States > static bool match( Input& /*unused*/, States&&... /*unused*/ ) noexcept @@ -37,8 +39,10 @@ namespace tao { template< apply_mode A, rewind_mode M, - template< typename... > class Action, - template< typename... > class Control, + template< typename... > + class Action, + template< typename... > + class Control, typename Input, typename... States > static bool match( Input& in, States&&... st ) diff --git a/thirdparty/PEGTL/include/tao/pegtl/internal/rules.hpp b/thirdparty/PEGTL/include/tao/pegtl/internal/rules.hpp old mode 100644 new mode 100755 index 6f72c0e..613c4ea --- a/thirdparty/PEGTL/include/tao/pegtl/internal/rules.hpp +++ b/thirdparty/PEGTL/include/tao/pegtl/internal/rules.hpp @@ -1,4 +1,4 @@ -// Copyright (c) 2014-2018 Dr. Colin Hirsch and Daniel Frey +// Copyright (c) 2014-2019 Dr. Colin Hirsch and Daniel Frey // Please see LICENSE for license or visit https://github.com/taocpp/PEGTL/ #ifndef TAO_PEGTL_INTERNAL_RULES_HPP @@ -31,7 +31,6 @@ #include "list_must.hpp" #include "list_tail.hpp" #include "list_tail_pad.hpp" -#include "minus.hpp" #include "must.hpp" #include "not_at.hpp" #include "one.hpp" @@ -42,6 +41,7 @@ #include "raise.hpp" #include "range.hpp" #include "ranges.hpp" +#include "rematch.hpp" #include "rep.hpp" #include "rep_min.hpp" #include "rep_min_max.hpp" @@ -54,10 +54,8 @@ #include "star_must.hpp" #include "state.hpp" #include "string.hpp" -#include "three.hpp" #include "trivial.hpp" #include "try_catch_type.hpp" -#include "two.hpp" #include "until.hpp" #endif diff --git a/thirdparty/PEGTL/include/tao/pegtl/internal/seq.hpp b/thirdparty/PEGTL/include/tao/pegtl/internal/seq.hpp old mode 100644 new mode 100755 index 4c751c4..781b17d --- a/thirdparty/PEGTL/include/tao/pegtl/internal/seq.hpp +++ b/thirdparty/PEGTL/include/tao/pegtl/internal/seq.hpp @@ -1,4 +1,4 @@ -// Copyright (c) 2014-2018 Dr. Colin Hirsch and Daniel Frey +// Copyright (c) 2014-2019 Dr. Colin Hirsch and Daniel Frey // Please see LICENSE for license or visit https://github.com/taocpp/PEGTL/ #ifndef TAO_PEGTL_INTERNAL_SEQ_HPP @@ -37,8 +37,10 @@ namespace tao template< apply_mode A, rewind_mode M, - template< typename... > class Action, - template< typename... > class Control, + template< typename... > + class Action, + template< typename... > + class Control, typename Input, typename... States > static bool match( Input& in, States&&... st ) @@ -50,12 +52,14 @@ namespace tao template< typename... Rules > struct seq { - using analyze_t = analysis::generic< analysis::rule_type::SEQ, Rules... >; + using analyze_t = analysis::generic< analysis::rule_type::seq, Rules... >; template< apply_mode A, rewind_mode M, - template< typename... > class Action, - template< typename... > class Control, + template< typename... > + class Action, + template< typename... > + class Control, typename Input, typename... States > static bool match( Input& in, States&&... st ) diff --git a/thirdparty/PEGTL/include/tao/pegtl/internal/skip_control.hpp b/thirdparty/PEGTL/include/tao/pegtl/internal/skip_control.hpp old mode 100644 new mode 100755 index 29ce86f..ede4e2d --- a/thirdparty/PEGTL/include/tao/pegtl/internal/skip_control.hpp +++ b/thirdparty/PEGTL/include/tao/pegtl/internal/skip_control.hpp @@ -1,4 +1,4 @@ -// Copyright (c) 2014-2018 Dr. Colin Hirsch and Daniel Frey +// Copyright (c) 2014-2019 Dr. Colin Hirsch and Daniel Frey // Please see LICENSE for license or visit https://github.com/taocpp/PEGTL/ #ifndef TAO_PEGTL_INTERNAL_SKIP_CONTROL_HPP diff --git a/thirdparty/PEGTL/include/tao/pegtl/internal/sor.hpp b/thirdparty/PEGTL/include/tao/pegtl/internal/sor.hpp old mode 100644 new mode 100755 index 3108a64..181c3e6 --- a/thirdparty/PEGTL/include/tao/pegtl/internal/sor.hpp +++ b/thirdparty/PEGTL/include/tao/pegtl/internal/sor.hpp @@ -1,4 +1,4 @@ -// Copyright (c) 2014-2018 Dr. Colin Hirsch and Daniel Frey +// Copyright (c) 2014-2019 Dr. Colin Hirsch and Daniel Frey // Please see LICENSE for license or visit https://github.com/taocpp/PEGTL/ #ifndef TAO_PEGTL_INTERNAL_SOR_HPP @@ -39,22 +39,24 @@ namespace tao template< std::size_t... Indices, typename... Rules > struct sor< index_sequence< Indices... >, Rules... > { - using analyze_t = analysis::generic< analysis::rule_type::SOR, Rules... >; + using analyze_t = analysis::generic< analysis::rule_type::sor, Rules... >; template< apply_mode A, rewind_mode M, - template< typename... > class Action, - template< typename... > class Control, + template< typename... > + class Action, + template< typename... > + class Control, typename Input, typename... States > static bool match( Input& in, States&&... st ) { #ifdef __cpp_fold_expressions - return ( Control< Rules >::template match < A, ( Indices == ( sizeof...( Rules ) - 1 ) ) ? M : rewind_mode::REQUIRED, Action, Control > ( in, st... ) || ... ); + return ( Control< Rules >::template match < A, ( Indices == ( sizeof...( Rules ) - 1 ) ) ? M : rewind_mode::required, Action, Control > ( in, st... ) || ... ); #else bool result = false; using swallow = bool[]; - (void)swallow{ result = result || Control< Rules >::template match < A, ( Indices == ( sizeof...( Rules ) - 1 ) ) ? M : rewind_mode::REQUIRED, Action, Control > ( in, st... )... }; + (void)swallow{ result = result || Control< Rules >::template match < A, ( Indices == ( sizeof...( Rules ) - 1 ) ) ? M : rewind_mode::required, Action, Control > ( in, st... )... }; return result; #endif } diff --git a/thirdparty/PEGTL/include/tao/pegtl/internal/star.hpp b/thirdparty/PEGTL/include/tao/pegtl/internal/star.hpp old mode 100644 new mode 100755 index cfa3c8a..3ebdaf7 --- a/thirdparty/PEGTL/include/tao/pegtl/internal/star.hpp +++ b/thirdparty/PEGTL/include/tao/pegtl/internal/star.hpp @@ -1,4 +1,4 @@ -// Copyright (c) 2014-2018 Dr. Colin Hirsch and Daniel Frey +// Copyright (c) 2014-2019 Dr. Colin Hirsch and Daniel Frey // Please see LICENSE for license or visit https://github.com/taocpp/PEGTL/ #ifndef TAO_PEGTL_INTERNAL_STAR_HPP @@ -26,17 +26,19 @@ namespace tao template< typename Rule, typename... Rules > struct star { - using analyze_t = analysis::generic< analysis::rule_type::OPT, Rule, Rules..., star >; + using analyze_t = analysis::generic< analysis::rule_type::opt, Rule, Rules..., star >; template< apply_mode A, rewind_mode, - template< typename... > class Action, - template< typename... > class Control, + template< typename... > + class Action, + template< typename... > + class Control, typename Input, typename... States > static bool match( Input& in, States&&... st ) { - while( seq< Rule, Rules... >::template match< A, rewind_mode::REQUIRED, Action, Control >( in, st... ) ) { + while( seq< Rule, Rules... >::template match< A, rewind_mode::required, Action, Control >( in, st... ) ) { } return true; } diff --git a/thirdparty/PEGTL/include/tao/pegtl/internal/star_must.hpp b/thirdparty/PEGTL/include/tao/pegtl/internal/star_must.hpp old mode 100644 new mode 100755 index 41b0657..acbd749 --- a/thirdparty/PEGTL/include/tao/pegtl/internal/star_must.hpp +++ b/thirdparty/PEGTL/include/tao/pegtl/internal/star_must.hpp @@ -1,4 +1,4 @@ -// Copyright (c) 2014-2018 Dr. Colin Hirsch and Daniel Frey +// Copyright (c) 2014-2019 Dr. Colin Hirsch and Daniel Frey // Please see LICENSE for license or visit https://github.com/taocpp/PEGTL/ #ifndef TAO_PEGTL_INTERNAL_STAR_MUST_HPP diff --git a/thirdparty/PEGTL/include/tao/pegtl/internal/state.hpp b/thirdparty/PEGTL/include/tao/pegtl/internal/state.hpp old mode 100644 new mode 100755 index 0d8b92a..8880133 --- a/thirdparty/PEGTL/include/tao/pegtl/internal/state.hpp +++ b/thirdparty/PEGTL/include/tao/pegtl/internal/state.hpp @@ -1,4 +1,4 @@ -// Copyright (c) 2014-2018 Dr. Colin Hirsch and Daniel Frey +// Copyright (c) 2014-2019 Dr. Colin Hirsch and Daniel Frey // Please see LICENSE for license or visit https://github.com/taocpp/PEGTL/ #ifndef TAO_PEGTL_INTERNAL_STATE_HPP @@ -24,12 +24,14 @@ namespace tao template< typename State, typename... Rules > struct state { - using analyze_t = analysis::generic< analysis::rule_type::SEQ, Rules... >; + using analyze_t = analysis::generic< analysis::rule_type::seq, Rules... >; template< apply_mode A, rewind_mode M, - template< typename... > class Action, - template< typename... > class Control, + template< typename... > + class Action, + template< typename... > + class Control, typename Input, typename... States > static auto success( State& s, const Input& in, States&&... st ) @@ -42,8 +44,10 @@ namespace tao template< apply_mode, rewind_mode, - template< typename... > class Action, - template< typename... > class Control, + template< typename... > + class Action, + template< typename... > + class Control, typename Input, typename... States, int = 0 > @@ -55,8 +59,10 @@ namespace tao template< apply_mode A, rewind_mode M, - template< typename... > class Action, - template< typename... > class Control, + template< typename... > + class Action, + template< typename... > + class Control, typename Input, typename... States > static bool match( Input& in, States&&... st ) diff --git a/thirdparty/PEGTL/include/tao/pegtl/internal/string.hpp b/thirdparty/PEGTL/include/tao/pegtl/internal/string.hpp old mode 100644 new mode 100755 index 49cdf8f..81e797d --- a/thirdparty/PEGTL/include/tao/pegtl/internal/string.hpp +++ b/thirdparty/PEGTL/include/tao/pegtl/internal/string.hpp @@ -1,4 +1,4 @@ -// Copyright (c) 2014-2018 Dr. Colin Hirsch and Daniel Frey +// Copyright (c) 2014-2019 Dr. Colin Hirsch and Daniel Frey // Please see LICENSE for license or visit https://github.com/taocpp/PEGTL/ #ifndef TAO_PEGTL_INTERNAL_STRING_HPP @@ -39,14 +39,14 @@ namespace tao template< char... Cs > struct string { - using analyze_t = analysis::counted< analysis::rule_type::ANY, sizeof...( Cs ) >; + using analyze_t = analysis::counted< analysis::rule_type::any, sizeof...( Cs ) >; template< typename Input > static bool match( Input& in ) noexcept( noexcept( in.size( 0 ) ) ) { if( in.size( sizeof...( Cs ) ) >= sizeof...( Cs ) ) { if( unsafe_equals( in.current(), { Cs... } ) ) { - bump_help< result_on_found::SUCCESS, Input, char, Cs... >( in, sizeof...( Cs ) ); + bump_help< result_on_found::success, Input, char, Cs... >( in, sizeof...( Cs ) ); return true; } } diff --git a/thirdparty/PEGTL/include/tao/pegtl/internal/three.hpp b/thirdparty/PEGTL/include/tao/pegtl/internal/three.hpp deleted file mode 100644 index bd6fe52..0000000 --- a/thirdparty/PEGTL/include/tao/pegtl/internal/three.hpp +++ /dev/null @@ -1,52 +0,0 @@ -// Copyright (c) 2018 Dr. Colin Hirsch and Daniel Frey -// Please see LICENSE for license or visit https://github.com/taocpp/PEGTL/ - -#ifndef TAO_PEGTL_INTERNAL_THREE_HPP -#define TAO_PEGTL_INTERNAL_THREE_HPP - -#include - -#include "../config.hpp" - -#include "bump_help.hpp" -#include "result_on_found.hpp" -#include "skip_control.hpp" - -#include "../analysis/generic.hpp" - -namespace tao -{ - namespace TAO_PEGTL_NAMESPACE - { - namespace internal - { - template< char C > - struct three - { - using analyze_t = analysis::generic< analysis::rule_type::ANY >; - - template< typename Input > - static bool match( Input& in ) noexcept( noexcept( in.size( 3 ) ) ) - { - if( in.size( 3 ) >= 3 ) { - if( ( in.peek_char( 0 ) == C ) && ( in.peek_char( 1 ) == C ) && ( in.peek_char( 2 ) == C ) ) { - bump_help< result_on_found::SUCCESS, Input, char, C >( in, 3 ); - return true; - } - } - return false; - } - }; - - template< char C > - struct skip_control< three< C > > : std::true_type - { - }; - - } // namespace internal - - } // namespace TAO_PEGTL_NAMESPACE - -} // namespace tao - -#endif diff --git a/thirdparty/PEGTL/include/tao/pegtl/internal/trivial.hpp b/thirdparty/PEGTL/include/tao/pegtl/internal/trivial.hpp old mode 100644 new mode 100755 index 38479d2..885d625 --- a/thirdparty/PEGTL/include/tao/pegtl/internal/trivial.hpp +++ b/thirdparty/PEGTL/include/tao/pegtl/internal/trivial.hpp @@ -1,4 +1,4 @@ -// Copyright (c) 2014-2018 Dr. Colin Hirsch and Daniel Frey +// Copyright (c) 2014-2019 Dr. Colin Hirsch and Daniel Frey // Please see LICENSE for license or visit https://github.com/taocpp/PEGTL/ #ifndef TAO_PEGTL_INTERNAL_TRIVIAL_HPP @@ -19,7 +19,7 @@ namespace tao template< bool Result > struct trivial { - using analyze_t = analysis::counted< analysis::rule_type::ANY, unsigned( !Result ) >; + using analyze_t = analysis::counted< analysis::rule_type::any, unsigned( !Result ) >; template< typename Input > static bool match( Input& /*unused*/ ) noexcept diff --git a/thirdparty/PEGTL/include/tao/pegtl/internal/try_catch_type.hpp b/thirdparty/PEGTL/include/tao/pegtl/internal/try_catch_type.hpp old mode 100644 new mode 100755 index e70e432..f91f489 --- a/thirdparty/PEGTL/include/tao/pegtl/internal/try_catch_type.hpp +++ b/thirdparty/PEGTL/include/tao/pegtl/internal/try_catch_type.hpp @@ -1,4 +1,4 @@ -// Copyright (c) 2014-2018 Dr. Colin Hirsch and Daniel Frey +// Copyright (c) 2014-2019 Dr. Colin Hirsch and Daniel Frey // Please see LICENSE for license or visit https://github.com/taocpp/PEGTL/ #ifndef TAO_PEGTL_INTERNAL_TRY_CATCH_TYPE_HPP @@ -36,12 +36,14 @@ namespace tao template< typename Exception, typename... Rules > struct try_catch_type { - using analyze_t = analysis::generic< analysis::rule_type::SEQ, Rules... >; + using analyze_t = analysis::generic< analysis::rule_type::seq, Rules... >; template< apply_mode A, rewind_mode M, - template< typename... > class Action, - template< typename... > class Control, + template< typename... > + class Action, + template< typename... > + class Control, typename Input, typename... States > static bool match( Input& in, States&&... st ) diff --git a/thirdparty/PEGTL/include/tao/pegtl/internal/two.hpp b/thirdparty/PEGTL/include/tao/pegtl/internal/two.hpp deleted file mode 100644 index 69eaf4b..0000000 --- a/thirdparty/PEGTL/include/tao/pegtl/internal/two.hpp +++ /dev/null @@ -1,52 +0,0 @@ -// Copyright (c) 2018 Dr. Colin Hirsch and Daniel Frey -// Please see LICENSE for license or visit https://github.com/taocpp/PEGTL/ - -#ifndef TAO_PEGTL_INTERNAL_TWO_HPP -#define TAO_PEGTL_INTERNAL_TWO_HPP - -#include - -#include "../config.hpp" - -#include "bump_help.hpp" -#include "result_on_found.hpp" -#include "skip_control.hpp" - -#include "../analysis/generic.hpp" - -namespace tao -{ - namespace TAO_PEGTL_NAMESPACE - { - namespace internal - { - template< char C > - struct two - { - using analyze_t = analysis::generic< analysis::rule_type::ANY >; - - template< typename Input > - static bool match( Input& in ) noexcept( noexcept( in.size( 2 ) ) ) - { - if( in.size( 2 ) >= 2 ) { - if( ( in.peek_char( 0 ) == C ) && ( in.peek_char( 1 ) == C ) ) { - bump_help< result_on_found::SUCCESS, Input, char, C >( in, 2 ); - return true; - } - } - return false; - } - }; - - template< char C > - struct skip_control< two< C > > : std::true_type - { - }; - - } // namespace internal - - } // namespace TAO_PEGTL_NAMESPACE - -} // namespace tao - -#endif diff --git a/thirdparty/PEGTL/include/tao/pegtl/internal/until.hpp b/thirdparty/PEGTL/include/tao/pegtl/internal/until.hpp old mode 100644 new mode 100755 index c6a002e..d31dc08 --- a/thirdparty/PEGTL/include/tao/pegtl/internal/until.hpp +++ b/thirdparty/PEGTL/include/tao/pegtl/internal/until.hpp @@ -1,4 +1,4 @@ -// Copyright (c) 2014-2018 Dr. Colin Hirsch and Daniel Frey +// Copyright (c) 2014-2019 Dr. Colin Hirsch and Daniel Frey // Please see LICENSE for license or visit https://github.com/taocpp/PEGTL/ #ifndef TAO_PEGTL_INTERNAL_UNTIL_HPP @@ -30,19 +30,21 @@ namespace tao template< typename Cond > struct until< Cond > { - using analyze_t = analysis::generic< analysis::rule_type::SEQ, star< not_at< Cond >, not_at< eof >, bytes< 1 > >, Cond >; + using analyze_t = analysis::generic< analysis::rule_type::seq, star< not_at< Cond >, not_at< eof >, bytes< 1 > >, Cond >; template< apply_mode A, rewind_mode M, - template< typename... > class Action, - template< typename... > class Control, + template< typename... > + class Action, + template< typename... > + class Control, typename Input, typename... States > static bool match( Input& in, States&&... st ) { auto m = in.template mark< M >(); - while( !Control< Cond >::template match< A, rewind_mode::REQUIRED, Action, Control >( in, st... ) ) { + while( !Control< Cond >::template match< A, rewind_mode::required, Action, Control >( in, st... ) ) { if( in.empty() ) { return false; } @@ -55,12 +57,14 @@ namespace tao template< typename Cond, typename... Rules > struct until { - using analyze_t = analysis::generic< analysis::rule_type::SEQ, star< not_at< Cond >, not_at< eof >, Rules... >, Cond >; + using analyze_t = analysis::generic< analysis::rule_type::seq, star< not_at< Cond >, not_at< eof >, Rules... >, Cond >; template< apply_mode A, rewind_mode M, - template< typename... > class Action, - template< typename... > class Control, + template< typename... > + class Action, + template< typename... > + class Control, typename Input, typename... States > static bool match( Input& in, States&&... st ) @@ -68,7 +72,7 @@ namespace tao auto m = in.template mark< M >(); using m_t = decltype( m ); - while( !Control< Cond >::template match< A, rewind_mode::REQUIRED, Action, Control >( in, st... ) ) { + while( !Control< Cond >::template match< A, rewind_mode::required, Action, Control >( in, st... ) ) { if( !rule_conjunction< Rules... >::template match< A, m_t::next_rewind_mode, Action, Control >( in, st... ) ) { return false; } diff --git a/thirdparty/PEGTL/include/tao/pegtl/istream_input.hpp b/thirdparty/PEGTL/include/tao/pegtl/istream_input.hpp old mode 100644 new mode 100755 index f598753..191ba87 --- a/thirdparty/PEGTL/include/tao/pegtl/istream_input.hpp +++ b/thirdparty/PEGTL/include/tao/pegtl/istream_input.hpp @@ -1,4 +1,4 @@ -// Copyright (c) 2017-2018 Dr. Colin Hirsch and Daniel Frey +// Copyright (c) 2017-2019 Dr. Colin Hirsch and Daniel Frey // Please see LICENSE for license or visit https://github.com/taocpp/PEGTL/ #ifndef TAO_PEGTL_ISTREAM_INPUT_HPP @@ -16,13 +16,13 @@ namespace tao { namespace TAO_PEGTL_NAMESPACE { - template< typename Eol = eol::lf_crlf > + template< typename Eol = eol::lf_crlf, std::size_t Chunk = 64 > struct istream_input - : buffer_input< internal::istream_reader, Eol > + : buffer_input< internal::istream_reader, Eol, std::string, Chunk > { template< typename T > istream_input( std::istream& in_stream, const std::size_t in_maximum, T&& in_source ) - : buffer_input< internal::istream_reader, Eol >( std::forward< T >( in_source ), in_maximum, in_stream ) + : buffer_input< internal::istream_reader, Eol, std::string, Chunk >( std::forward< T >( in_source ), in_maximum, in_stream ) { } }; diff --git a/thirdparty/PEGTL/include/tao/pegtl/match.hpp b/thirdparty/PEGTL/include/tao/pegtl/match.hpp new file mode 100755 index 0000000..9e47cab --- /dev/null +++ b/thirdparty/PEGTL/include/tao/pegtl/match.hpp @@ -0,0 +1,71 @@ +// Copyright (c) 2019 Dr. Colin Hirsch and Daniel Frey +// Please see LICENSE for license or visit https://github.com/taocpp/PEGTL/ + +#ifndef TAO_PEGTL_MATCH_HPP +#define TAO_PEGTL_MATCH_HPP + +#include + +#include "apply_mode.hpp" +#include "config.hpp" +#include "nothing.hpp" +#include "require_apply.hpp" +#include "require_apply0.hpp" +#include "rewind_mode.hpp" + +#include "internal/dusel_mode.hpp" +#include "internal/duseltronik.hpp" +#include "internal/has_apply.hpp" +#include "internal/has_apply0.hpp" +#include "internal/if_missing.hpp" +#include "internal/skip_control.hpp" + +namespace tao +{ + namespace TAO_PEGTL_NAMESPACE + { + template< typename Rule, + apply_mode A, + rewind_mode M, + template< typename... > + class Action, + template< typename... > + class Control, + typename Input, + typename... States > + bool match( Input& in, States&&... st ) + { + constexpr bool enable_control = !internal::skip_control< Rule >::value; + constexpr bool enable_action = enable_control && ( A == apply_mode::action ); + + using iterator_t = typename Input::iterator_t; + constexpr bool has_apply_void = enable_action && internal::has_apply< Control< Rule >, void, Action, const iterator_t&, const Input&, States... >::value; + constexpr bool has_apply_bool = enable_action && internal::has_apply< Control< Rule >, bool, Action, const iterator_t&, const Input&, States... >::value; + constexpr bool has_apply = has_apply_void || has_apply_bool; + + constexpr bool has_apply0_void = enable_action && internal::has_apply0< Control< Rule >, void, Action, const Input&, States... >::value; + constexpr bool has_apply0_bool = enable_action && internal::has_apply0< Control< Rule >, bool, Action, const Input&, States... >::value; + constexpr bool has_apply0 = has_apply0_void || has_apply0_bool; + + static_assert( !( has_apply && has_apply0 ), "both apply() and apply0() defined" ); + + constexpr bool is_nothing = std::is_base_of< nothing< Rule >, Action< Rule > >::value; + static_assert( !( has_apply && is_nothing ), "unexpected apply() defined" ); + static_assert( !( has_apply0 && is_nothing ), "unexpected apply0() defined" ); + + internal::if_missing< !has_apply && std::is_base_of< require_apply, Action< Rule > >::value >::template apply< Control< Rule >, Action >( in, st... ); + internal::if_missing< !has_apply0 && std::is_base_of< require_apply0, Action< Rule > >::value >::template apply0< Control< Rule >, Action >( in, st... ); + + constexpr bool validate_nothing = std::is_base_of< maybe_nothing, Action< void > >::value; + constexpr bool is_maybe_nothing = std::is_base_of< maybe_nothing, Action< Rule > >::value; + static_assert( !enable_action || !validate_nothing || is_nothing || is_maybe_nothing || has_apply || has_apply0, "either apply() or apply0() must be defined" ); + + constexpr auto mode = static_cast< internal::dusel_mode >( enable_control + has_apply_void + 2 * has_apply_bool + 3 * has_apply0_void + 4 * has_apply0_bool ); + return internal::duseltronik< Rule, A, M, Action, Control, mode >::match( in, st... ); + } + + } // namespace TAO_PEGTL_NAMESPACE + +} // namespace tao + +#endif diff --git a/thirdparty/PEGTL/include/tao/pegtl/memory_input.hpp b/thirdparty/PEGTL/include/tao/pegtl/memory_input.hpp old mode 100644 new mode 100755 index eb03184..2582b2d --- a/thirdparty/PEGTL/include/tao/pegtl/memory_input.hpp +++ b/thirdparty/PEGTL/include/tao/pegtl/memory_input.hpp @@ -1,4 +1,4 @@ -// Copyright (c) 2014-2018 Dr. Colin Hirsch and Daniel Frey +// Copyright (c) 2014-2019 Dr. Colin Hirsch and Daniel Frey // Please see LICENSE for license or visit https://github.com/taocpp/PEGTL/ #ifndef TAO_PEGTL_MEMORY_INPUT_HPP @@ -20,7 +20,7 @@ #include "internal/action_input.hpp" #include "internal/at.hpp" -#include "internal/bump_impl.hpp" +#include "internal/bump.hpp" #include "internal/eolf.hpp" #include "internal/iterator.hpp" #include "internal/marker.hpp" @@ -36,7 +36,7 @@ namespace tao class memory_input_base; template< typename Eol, typename Source > - class memory_input_base< tracking_mode::IMMEDIATE, Eol, Source > + class memory_input_base< tracking_mode::eager, Eol, Source > { public: using iterator_t = internal::iterator; @@ -125,6 +125,15 @@ namespace tao m_current.byte_in_line = in_byte_in_line; } + template< rewind_mode M > + void restart( const internal::marker< iterator_t, M >& m ) + { + m_current.data = m.iterator().data; + m_current.byte = m.iterator().byte; + m_current.line = m.iterator().line; + m_current.byte_in_line = m.iterator().byte_in_line; + } + protected: const char* const m_begin; iterator_t m_current; @@ -133,7 +142,7 @@ namespace tao }; template< typename Eol, typename Source > - class memory_input_base< tracking_mode::LAZY, Eol, Source > + class memory_input_base< tracking_mode::lazy, Eol, Source > { public: using iterator_t = const char*; @@ -211,6 +220,12 @@ namespace tao m_current = m_begin.data; } + template< rewind_mode M > + void restart( const internal::marker< iterator_t, M >& m ) + { + m_current = m.iterator(); + } + protected: const internal::iterator m_begin; iterator_t m_current; @@ -220,7 +235,7 @@ namespace tao } // namespace internal - template< tracking_mode P = tracking_mode::IMMEDIATE, typename Eol = eol::lf_crlf, typename Source = std::string > + template< tracking_mode P = tracking_mode::eager, typename Eol = eol::lf_crlf, typename Source = std::string > class memory_input : public internal::memory_input_base< P, Eol, Source > { @@ -291,6 +306,12 @@ namespace tao return this->current()[ offset ]; } + std::uint8_t peek_uint8( const std::size_t offset = 0 ) const noexcept + { + return static_cast< std::uint8_t >( peek_char( offset ) ); + } + + // Compatibility, remove with 3.0.0 std::uint8_t peek_byte( const std::size_t offset = 0 ) const noexcept { return static_cast< std::uint8_t >( peek_char( offset ) ); @@ -339,14 +360,14 @@ namespace tao const char* end_of_line( const TAO_PEGTL_NAMESPACE::position& p ) const noexcept { - using input_t = memory_input< tracking_mode::LAZY, Eol, const char* >; + using input_t = memory_input< tracking_mode::lazy, Eol, const char* >; input_t in( at( p ), this->end(), "" ); using grammar = internal::until< internal::at< internal::eolf > >; - normal< grammar >::match< apply_mode::NOTHING, rewind_mode::DONTCARE, nothing, normal >( in ); + normal< grammar >::match< apply_mode::nothing, rewind_mode::dontcare, nothing, normal >( in ); return in.current(); } - std::string line_as_string( const TAO_PEGTL_NAMESPACE::position& p ) const + std::string line_at( const TAO_PEGTL_NAMESPACE::position& p ) const { return std::string( begin_of_line( p ), end_of_line( p ) ); } diff --git a/thirdparty/PEGTL/include/tao/pegtl/mmap_input.hpp b/thirdparty/PEGTL/include/tao/pegtl/mmap_input.hpp old mode 100644 new mode 100755 index 92c38f6..53ff109 --- a/thirdparty/PEGTL/include/tao/pegtl/mmap_input.hpp +++ b/thirdparty/PEGTL/include/tao/pegtl/mmap_input.hpp @@ -1,4 +1,4 @@ -// Copyright (c) 2014-2018 Dr. Colin Hirsch and Daniel Frey +// Copyright (c) 2014-2019 Dr. Colin Hirsch and Daniel Frey // Please see LICENSE for license or visit https://github.com/taocpp/PEGTL/ #ifndef TAO_PEGTL_MMAP_INPUT_HPP @@ -52,7 +52,7 @@ namespace tao } // namespace internal - template< tracking_mode P = tracking_mode::IMMEDIATE, typename Eol = eol::lf_crlf > + template< tracking_mode P = tracking_mode::eager, typename Eol = eol::lf_crlf > struct mmap_input : private internal::mmap_holder, public memory_input< P, Eol, const char* > diff --git a/thirdparty/PEGTL/include/tao/pegtl/normal.hpp b/thirdparty/PEGTL/include/tao/pegtl/normal.hpp old mode 100644 new mode 100755 index 8f7949a..e11bda4 --- a/thirdparty/PEGTL/include/tao/pegtl/normal.hpp +++ b/thirdparty/PEGTL/include/tao/pegtl/normal.hpp @@ -1,23 +1,20 @@ -// Copyright (c) 2014-2018 Dr. Colin Hirsch and Daniel Frey +// Copyright (c) 2014-2019 Dr. Colin Hirsch and Daniel Frey // Please see LICENSE for license or visit https://github.com/taocpp/PEGTL/ #ifndef TAO_PEGTL_NORMAL_HPP #define TAO_PEGTL_NORMAL_HPP +#include #include #include "apply_mode.hpp" #include "config.hpp" -#include "nothing.hpp" +#include "match.hpp" #include "parse_error.hpp" #include "rewind_mode.hpp" #include "internal/demangle.hpp" -#include "internal/dusel_mode.hpp" -#include "internal/duseltronik.hpp" -#include "internal/has_apply.hpp" -#include "internal/has_apply0.hpp" -#include "internal/skip_control.hpp" +#include "internal/has_match.hpp" namespace tao { @@ -64,22 +61,31 @@ namespace tao template< apply_mode A, rewind_mode M, - template< typename... > class Action, - template< typename... > class Control, + template< typename... > + class Action, + template< typename... > + class Control, typename Input, typename... States > - static bool match( Input& in, States&&... st ) + static auto match( Input& in, States&&... st ) + -> typename std::enable_if< internal::has_match< void, Rule, A, M, Action, Control, Input, States... >::value, bool >::type { - constexpr char use_control = !internal::skip_control< Rule >::value; - constexpr char use_action = use_control && ( A == apply_mode::ACTION ) && ( !is_nothing< Action, Rule >::value ); - constexpr char use_apply_void = use_action && internal::has_apply< Action< Rule >, void, typename Input::action_t, States... >::value; - constexpr char use_apply_bool = use_action && internal::has_apply< Action< Rule >, bool, typename Input::action_t, States... >::value; - constexpr char use_apply0_void = use_action && internal::has_apply0< Action< Rule >, void, States... >::value; - constexpr char use_apply0_bool = use_action && internal::has_apply0< Action< Rule >, bool, States... >::value; - static_assert( !use_action || use_apply_bool || use_apply_void || use_apply0_bool || use_apply0_void, "actions not disabled but no apply() or apply0() found" ); - static_assert( use_apply_void + use_apply_bool + use_apply0_void + use_apply0_bool < 2, "both apply() and apply0() defined" ); - constexpr auto mode = static_cast< dusel_mode >( use_control + use_apply_void + 2 * use_apply_bool + 3 * use_apply0_void + 4 * use_apply0_bool ); - return internal::duseltronik< Rule, A, M, Action, Control, mode >::match( in, st... ); + return Action< Rule >::template match< Rule, A, M, Action, Control >( in, st... ); + } + + template< apply_mode A, + rewind_mode M, + template< typename... > + class Action, + template< typename... > + class Control, + typename Input, + typename... States, + int = 1 > + static auto match( Input& in, States&&... st ) + -> typename std::enable_if< !internal::has_match< void, Rule, A, M, Action, Control, Input, States... >::value, bool >::type + { + return TAO_PEGTL_NAMESPACE::match< Rule, A, M, Action, Control >( in, st... ); } }; diff --git a/thirdparty/PEGTL/include/tao/pegtl/nothing.hpp b/thirdparty/PEGTL/include/tao/pegtl/nothing.hpp old mode 100644 new mode 100755 index 9d2ae16..c8c2c12 --- a/thirdparty/PEGTL/include/tao/pegtl/nothing.hpp +++ b/thirdparty/PEGTL/include/tao/pegtl/nothing.hpp @@ -1,11 +1,9 @@ -// Copyright (c) 2014-2018 Dr. Colin Hirsch and Daniel Frey +// Copyright (c) 2014-2019 Dr. Colin Hirsch and Daniel Frey // Please see LICENSE for license or visit https://github.com/taocpp/PEGTL/ #ifndef TAO_PEGTL_NOTHING_HPP #define TAO_PEGTL_NOTHING_HPP -#include - #include "config.hpp" namespace tao @@ -17,8 +15,7 @@ namespace tao { }; - template< template< typename... > class Action, typename Rule > - using is_nothing = std::is_base_of< nothing< Rule >, Action< Rule > >; + using maybe_nothing = nothing< void >; } // namespace TAO_PEGTL_NAMESPACE diff --git a/thirdparty/PEGTL/include/tao/pegtl/parse.hpp b/thirdparty/PEGTL/include/tao/pegtl/parse.hpp old mode 100644 new mode 100755 index 3ac7d03..9b239fb --- a/thirdparty/PEGTL/include/tao/pegtl/parse.hpp +++ b/thirdparty/PEGTL/include/tao/pegtl/parse.hpp @@ -1,4 +1,4 @@ -// Copyright (c) 2014-2018 Dr. Colin Hirsch and Daniel Frey +// Copyright (c) 2014-2019 Dr. Colin Hirsch and Daniel Frey // Please see LICENSE for license or visit https://github.com/taocpp/PEGTL/ #ifndef TAO_PEGTL_PARSE_HPP @@ -22,8 +22,8 @@ namespace tao template< typename Rule, template< typename... > class Action = nothing, template< typename... > class Control = normal, - apply_mode A = apply_mode::ACTION, - rewind_mode M = rewind_mode::REQUIRED, + apply_mode A = apply_mode::action, + rewind_mode M = rewind_mode::required, typename Input, typename... States > bool parse( Input&& in, States&&... st ) @@ -34,8 +34,8 @@ namespace tao template< typename Rule, template< typename... > class Action = nothing, template< typename... > class Control = normal, - apply_mode A = apply_mode::ACTION, - rewind_mode M = rewind_mode::REQUIRED, + apply_mode A = apply_mode::action, + rewind_mode M = rewind_mode::required, typename Outer, typename Input, typename... States > diff --git a/thirdparty/PEGTL/include/tao/pegtl/parse_error.hpp b/thirdparty/PEGTL/include/tao/pegtl/parse_error.hpp old mode 100644 new mode 100755 index 4d62811..45c2437 --- a/thirdparty/PEGTL/include/tao/pegtl/parse_error.hpp +++ b/thirdparty/PEGTL/include/tao/pegtl/parse_error.hpp @@ -1,4 +1,4 @@ -// Copyright (c) 2014-2018 Dr. Colin Hirsch and Daniel Frey +// Copyright (c) 2014-2019 Dr. Colin Hirsch and Daniel Frey // Please see LICENSE for license or visit https://github.com/taocpp/PEGTL/ #ifndef TAO_PEGTL_PARSE_ERROR_HPP @@ -35,6 +35,13 @@ namespace tao { } + parse_error( const std::string& msg, position&& pos ) + : std::runtime_error( to_string( pos ) + ": " + msg ), + positions() + { + positions.emplace_back( std::move( pos ) ); + } + std::vector< position > positions; }; diff --git a/thirdparty/PEGTL/include/tao/pegtl/position.hpp b/thirdparty/PEGTL/include/tao/pegtl/position.hpp old mode 100644 new mode 100755 index a7fe2b3..60904a0 --- a/thirdparty/PEGTL/include/tao/pegtl/position.hpp +++ b/thirdparty/PEGTL/include/tao/pegtl/position.hpp @@ -1,4 +1,4 @@ -// Copyright (c) 2014-2018 Dr. Colin Hirsch and Daniel Frey +// Copyright (c) 2014-2019 Dr. Colin Hirsch and Daniel Frey // Please see LICENSE for license or visit https://github.com/taocpp/PEGTL/ #ifndef TAO_PEGTL_POSITION_HPP diff --git a/thirdparty/PEGTL/include/tao/pegtl/read_input.hpp b/thirdparty/PEGTL/include/tao/pegtl/read_input.hpp old mode 100644 new mode 100755 index 8d7eb04..55db558 --- a/thirdparty/PEGTL/include/tao/pegtl/read_input.hpp +++ b/thirdparty/PEGTL/include/tao/pegtl/read_input.hpp @@ -1,4 +1,4 @@ -// Copyright (c) 2014-2018 Dr. Colin Hirsch and Daniel Frey +// Copyright (c) 2014-2019 Dr. Colin Hirsch and Daniel Frey // Please see LICENSE for license or visit https://github.com/taocpp/PEGTL/ #ifndef TAO_PEGTL_READ_INPUT_HPP @@ -40,7 +40,7 @@ namespace tao } // namespace internal - template< tracking_mode P = tracking_mode::IMMEDIATE, typename Eol = eol::lf_crlf > + template< tracking_mode P = tracking_mode::eager, typename Eol = eol::lf_crlf > struct read_input : private internal::filename_holder, public string_input< P, Eol, const char* > diff --git a/thirdparty/PEGTL/include/tao/pegtl/require_apply.hpp b/thirdparty/PEGTL/include/tao/pegtl/require_apply.hpp new file mode 100755 index 0000000..9d2cb0a --- /dev/null +++ b/thirdparty/PEGTL/include/tao/pegtl/require_apply.hpp @@ -0,0 +1,20 @@ +// Copyright (c) 2019 Dr. Colin Hirsch and Daniel Frey +// Please see LICENSE for license or visit https://github.com/taocpp/PEGTL/ + +#ifndef TAO_PEGTL_REQUIRE_APPLY_HPP +#define TAO_PEGTL_REQUIRE_APPLY_HPP + +#include "config.hpp" + +namespace tao +{ + namespace TAO_PEGTL_NAMESPACE + { + struct require_apply + {}; + + } // namespace TAO_PEGTL_NAMESPACE + +} // namespace tao + +#endif diff --git a/thirdparty/PEGTL/include/tao/pegtl/require_apply0.hpp b/thirdparty/PEGTL/include/tao/pegtl/require_apply0.hpp new file mode 100755 index 0000000..0e7a51a --- /dev/null +++ b/thirdparty/PEGTL/include/tao/pegtl/require_apply0.hpp @@ -0,0 +1,20 @@ +// Copyright (c) 2019 Dr. Colin Hirsch and Daniel Frey +// Please see LICENSE for license or visit https://github.com/taocpp/PEGTL/ + +#ifndef TAO_PEGTL_REQUIRE_APPLY0_HPP +#define TAO_PEGTL_REQUIRE_APPLY0_HPP + +#include "config.hpp" + +namespace tao +{ + namespace TAO_PEGTL_NAMESPACE + { + struct require_apply0 + {}; + + } // namespace TAO_PEGTL_NAMESPACE + +} // namespace tao + +#endif diff --git a/thirdparty/PEGTL/include/tao/pegtl/rewind_mode.hpp b/thirdparty/PEGTL/include/tao/pegtl/rewind_mode.hpp old mode 100644 new mode 100755 index c12fddc..948d7a7 --- a/thirdparty/PEGTL/include/tao/pegtl/rewind_mode.hpp +++ b/thirdparty/PEGTL/include/tao/pegtl/rewind_mode.hpp @@ -1,4 +1,4 @@ -// Copyright (c) 2016-2018 Dr. Colin Hirsch and Daniel Frey +// Copyright (c) 2016-2019 Dr. Colin Hirsch and Daniel Frey // Please see LICENSE for license or visit https://github.com/taocpp/PEGTL/ #ifndef TAO_PEGTL_REWIND_MODE_HPP @@ -12,9 +12,14 @@ namespace tao { enum class rewind_mode : char { - ACTIVE, - REQUIRED, - DONTCARE + active, + required, + dontcare, + + // Compatibility, remove with 3.0.0 + ACTIVE = active, + REQUIRED = required, + DONTCARE = dontcare }; } // namespace TAO_PEGTL_NAMESPACE diff --git a/thirdparty/PEGTL/include/tao/pegtl/rules.hpp b/thirdparty/PEGTL/include/tao/pegtl/rules.hpp old mode 100644 new mode 100755 index 53364a4..6c2562f --- a/thirdparty/PEGTL/include/tao/pegtl/rules.hpp +++ b/thirdparty/PEGTL/include/tao/pegtl/rules.hpp @@ -1,4 +1,4 @@ -// Copyright (c) 2014-2018 Dr. Colin Hirsch and Daniel Frey +// Copyright (c) 2014-2019 Dr. Colin Hirsch and Daniel Frey // Please see LICENSE for license or visit https://github.com/taocpp/PEGTL/ #ifndef TAO_PEGTL_RULES_HPP @@ -37,7 +37,7 @@ namespace tao template< typename Rule, typename Sep > struct list_must< Rule, Sep, void > : internal::list_must< Rule, Sep > {}; template< typename Rule, typename Sep, typename Pad = void > struct list_tail : internal::list_tail_pad< Rule, Sep, Pad > {}; template< typename Rule, typename Sep > struct list_tail< Rule, Sep, void > : internal::list_tail< Rule, Sep > {}; - template< typename M, typename S > struct minus : internal::minus< M, S > {}; + template< typename M, typename S > struct minus : internal::rematch< M, internal::not_at< S, internal::eof > > {}; template< typename... Rules > struct must : internal::must< Rules... > {}; template< typename... Rules > struct not_at : internal::not_at< Rules... > {}; template< typename... Rules > struct opt : internal::opt< Rules... > {}; @@ -46,6 +46,7 @@ namespace tao template< typename Rule, typename Pad > struct pad_opt : internal::pad_opt< Rule, Pad > {}; template< typename Rule, typename... Rules > struct plus : internal::plus< Rule, Rules... > {}; template< typename Exception > struct raise : internal::raise< Exception > {}; + template< typename Head, typename... Rules > struct rematch : internal::rematch< Head, Rules... > {}; template< unsigned Num, typename... Rules > struct rep : internal::rep< Num, Rules... > {}; template< unsigned Max, typename... Rules > struct rep_max : internal::rep_min_max< 0, Max, Rules... > {}; template< unsigned Min, typename Rule, typename... Rules > struct rep_min : internal::rep_min< Min, Rule, Rules... > {}; diff --git a/thirdparty/PEGTL/include/tao/pegtl/string_input.hpp b/thirdparty/PEGTL/include/tao/pegtl/string_input.hpp old mode 100644 new mode 100755 index ebce236..3c417af --- a/thirdparty/PEGTL/include/tao/pegtl/string_input.hpp +++ b/thirdparty/PEGTL/include/tao/pegtl/string_input.hpp @@ -1,4 +1,4 @@ -// Copyright (c) 2014-2018 Dr. Colin Hirsch and Daniel Frey +// Copyright (c) 2014-2019 Dr. Colin Hirsch and Daniel Frey // Please see LICENSE for license or visit https://github.com/taocpp/PEGTL/ #ifndef TAO_PEGTL_STRING_INPUT_HPP @@ -39,7 +39,7 @@ namespace tao } // namespace internal - template< tracking_mode P = tracking_mode::IMMEDIATE, typename Eol = eol::lf_crlf, typename Source = std::string > + template< tracking_mode P = tracking_mode::eager, typename Eol = eol::lf_crlf, typename Source = std::string > struct string_input : private internal::string_holder, public memory_input< P, Eol, Source > diff --git a/thirdparty/PEGTL/include/tao/pegtl/tracking_mode.hpp b/thirdparty/PEGTL/include/tao/pegtl/tracking_mode.hpp old mode 100644 new mode 100755 index c470042..59d9505 --- a/thirdparty/PEGTL/include/tao/pegtl/tracking_mode.hpp +++ b/thirdparty/PEGTL/include/tao/pegtl/tracking_mode.hpp @@ -1,4 +1,4 @@ -// Copyright (c) 2017-2018 Dr. Colin Hirsch and Daniel Frey +// Copyright (c) 2017-2019 Dr. Colin Hirsch and Daniel Frey // Please see LICENSE for license or visit https://github.com/taocpp/PEGTL/ #ifndef TAO_PEGTL_TRACKING_MODE_HPP @@ -12,8 +12,12 @@ namespace tao { enum class tracking_mode : bool { - IMMEDIATE, - LAZY + eager, + lazy, + + // Compatibility, remove with 3.0.0 + IMMEDIATE = eager, + LAZY = lazy }; } // namespace TAO_PEGTL_NAMESPACE diff --git a/thirdparty/PEGTL/include/tao/pegtl/uint16.hpp b/thirdparty/PEGTL/include/tao/pegtl/uint16.hpp old mode 100644 new mode 100755 index d913ed2..1202b06 --- a/thirdparty/PEGTL/include/tao/pegtl/uint16.hpp +++ b/thirdparty/PEGTL/include/tao/pegtl/uint16.hpp @@ -1,4 +1,4 @@ -// Copyright (c) 2018 Dr. Colin Hirsch and Daniel Frey +// Copyright (c) 2018-2019 Dr. Colin Hirsch and Daniel Frey // Please see LICENSE for license or visit https://github.com/taocpp/PEGTL/ #ifndef TAO_PEGTL_UINT16_HPP @@ -20,19 +20,19 @@ namespace tao // clang-format off struct any : internal::any< internal::peek_uint16_be > {}; - template< std::uint16_t... Cs > struct not_one : internal::one< internal::result_on_found::FAILURE, internal::peek_uint16_be, Cs... > {}; - template< std::uint16_t Lo, std::uint16_t Hi > struct not_range : internal::range< internal::result_on_found::FAILURE, internal::peek_uint16_be, Lo, Hi > {}; - template< std::uint16_t... Cs > struct one : internal::one< internal::result_on_found::SUCCESS, internal::peek_uint16_be, Cs... > {}; - template< std::uint16_t Lo, std::uint16_t Hi > struct range : internal::range< internal::result_on_found::SUCCESS, internal::peek_uint16_be, Lo, Hi > {}; + template< std::uint16_t... Cs > struct not_one : internal::one< internal::result_on_found::failure, internal::peek_uint16_be, Cs... > {}; + template< std::uint16_t Lo, std::uint16_t Hi > struct not_range : internal::range< internal::result_on_found::failure, internal::peek_uint16_be, Lo, Hi > {}; + template< std::uint16_t... Cs > struct one : internal::one< internal::result_on_found::success, internal::peek_uint16_be, Cs... > {}; + template< std::uint16_t Lo, std::uint16_t Hi > struct range : internal::range< internal::result_on_found::success, internal::peek_uint16_be, Lo, Hi > {}; template< std::uint16_t... Cs > struct ranges : internal::ranges< internal::peek_uint16_be, Cs... > {}; - template< std::uint16_t... Cs > struct string : internal::seq< internal::one< internal::result_on_found::SUCCESS, internal::peek_uint16_be, Cs >... > {}; + template< std::uint16_t... Cs > struct string : internal::seq< internal::one< internal::result_on_found::success, internal::peek_uint16_be, Cs >... > {}; - template< std::uint16_t M, std::uint16_t... Cs > struct mask_not_one : internal::one< internal::result_on_found::FAILURE, internal::peek_mask_uint16_be< M >, Cs... > {}; - template< std::uint16_t M, std::uint16_t Lo, std::uint16_t Hi > struct mask_not_range : internal::range< internal::result_on_found::FAILURE, internal::peek_mask_uint16_be< M >, Lo, Hi > {}; - template< std::uint16_t M, std::uint16_t... Cs > struct mask_one : internal::one< internal::result_on_found::SUCCESS, internal::peek_mask_uint16_be< M >, Cs... > {}; - template< std::uint16_t M, std::uint16_t Lo, std::uint16_t Hi > struct mask_range : internal::range< internal::result_on_found::SUCCESS, internal::peek_mask_uint16_be< M >, Lo, Hi > {}; + template< std::uint16_t M, std::uint16_t... Cs > struct mask_not_one : internal::one< internal::result_on_found::failure, internal::peek_mask_uint16_be< M >, Cs... > {}; + template< std::uint16_t M, std::uint16_t Lo, std::uint16_t Hi > struct mask_not_range : internal::range< internal::result_on_found::failure, internal::peek_mask_uint16_be< M >, Lo, Hi > {}; + template< std::uint16_t M, std::uint16_t... Cs > struct mask_one : internal::one< internal::result_on_found::success, internal::peek_mask_uint16_be< M >, Cs... > {}; + template< std::uint16_t M, std::uint16_t Lo, std::uint16_t Hi > struct mask_range : internal::range< internal::result_on_found::success, internal::peek_mask_uint16_be< M >, Lo, Hi > {}; template< std::uint16_t M, std::uint16_t... Cs > struct mask_ranges : internal::ranges< internal::peek_mask_uint16_be< M >, Cs... > {}; - template< std::uint16_t M, std::uint16_t... Cs > struct mask_string : internal::seq< internal::one< internal::result_on_found::SUCCESS, internal::peek_mask_uint16_be< M >, Cs >... > {}; + template< std::uint16_t M, std::uint16_t... Cs > struct mask_string : internal::seq< internal::one< internal::result_on_found::success, internal::peek_mask_uint16_be< M >, Cs >... > {}; // clang-format on } // namespace uint16_be @@ -42,19 +42,19 @@ namespace tao // clang-format off struct any : internal::any< internal::peek_uint16_le > {}; - template< std::uint16_t... Cs > struct not_one : internal::one< internal::result_on_found::FAILURE, internal::peek_uint16_le, Cs... > {}; - template< std::uint16_t Lo, std::uint16_t Hi > struct not_range : internal::range< internal::result_on_found::FAILURE, internal::peek_uint16_le, Lo, Hi > {}; - template< std::uint16_t... Cs > struct one : internal::one< internal::result_on_found::SUCCESS, internal::peek_uint16_le, Cs... > {}; - template< std::uint16_t Lo, std::uint16_t Hi > struct range : internal::range< internal::result_on_found::SUCCESS, internal::peek_uint16_le, Lo, Hi > {}; + template< std::uint16_t... Cs > struct not_one : internal::one< internal::result_on_found::failure, internal::peek_uint16_le, Cs... > {}; + template< std::uint16_t Lo, std::uint16_t Hi > struct not_range : internal::range< internal::result_on_found::failure, internal::peek_uint16_le, Lo, Hi > {}; + template< std::uint16_t... Cs > struct one : internal::one< internal::result_on_found::success, internal::peek_uint16_le, Cs... > {}; + template< std::uint16_t Lo, std::uint16_t Hi > struct range : internal::range< internal::result_on_found::success, internal::peek_uint16_le, Lo, Hi > {}; template< std::uint16_t... Cs > struct ranges : internal::ranges< internal::peek_uint16_le, Cs... > {}; - template< std::uint16_t... Cs > struct string : internal::seq< internal::one< internal::result_on_found::SUCCESS, internal::peek_uint16_le, Cs >... > {}; + template< std::uint16_t... Cs > struct string : internal::seq< internal::one< internal::result_on_found::success, internal::peek_uint16_le, Cs >... > {}; - template< std::uint16_t M, std::uint16_t... Cs > struct mask_not_one : internal::one< internal::result_on_found::FAILURE, internal::peek_mask_uint16_le< M >, Cs... > {}; - template< std::uint16_t M, std::uint16_t Lo, std::uint16_t Hi > struct mask_not_range : internal::range< internal::result_on_found::FAILURE, internal::peek_mask_uint16_le< M >, Lo, Hi > {}; - template< std::uint16_t M, std::uint16_t... Cs > struct mask_one : internal::one< internal::result_on_found::SUCCESS, internal::peek_mask_uint16_le< M >, Cs... > {}; - template< std::uint16_t M, std::uint16_t Lo, std::uint16_t Hi > struct mask_range : internal::range< internal::result_on_found::SUCCESS, internal::peek_mask_uint16_le< M >, Lo, Hi > {}; + template< std::uint16_t M, std::uint16_t... Cs > struct mask_not_one : internal::one< internal::result_on_found::failure, internal::peek_mask_uint16_le< M >, Cs... > {}; + template< std::uint16_t M, std::uint16_t Lo, std::uint16_t Hi > struct mask_not_range : internal::range< internal::result_on_found::failure, internal::peek_mask_uint16_le< M >, Lo, Hi > {}; + template< std::uint16_t M, std::uint16_t... Cs > struct mask_one : internal::one< internal::result_on_found::success, internal::peek_mask_uint16_le< M >, Cs... > {}; + template< std::uint16_t M, std::uint16_t Lo, std::uint16_t Hi > struct mask_range : internal::range< internal::result_on_found::success, internal::peek_mask_uint16_le< M >, Lo, Hi > {}; template< std::uint16_t M, std::uint16_t... Cs > struct mask_ranges : internal::ranges< internal::peek_mask_uint16_le< M >, Cs... > {}; - template< std::uint16_t M, std::uint16_t... Cs > struct mask_string : internal::seq< internal::one< internal::result_on_found::SUCCESS, internal::peek_mask_uint16_le< M >, Cs >... > {}; + template< std::uint16_t M, std::uint16_t... Cs > struct mask_string : internal::seq< internal::one< internal::result_on_found::success, internal::peek_mask_uint16_le< M >, Cs >... > {}; // clang-format on } // namespace uint16_le diff --git a/thirdparty/PEGTL/include/tao/pegtl/uint32.hpp b/thirdparty/PEGTL/include/tao/pegtl/uint32.hpp old mode 100644 new mode 100755 index 12f5617..cd8fff9 --- a/thirdparty/PEGTL/include/tao/pegtl/uint32.hpp +++ b/thirdparty/PEGTL/include/tao/pegtl/uint32.hpp @@ -1,4 +1,4 @@ -// Copyright (c) 2018 Dr. Colin Hirsch and Daniel Frey +// Copyright (c) 2018-2019 Dr. Colin Hirsch and Daniel Frey // Please see LICENSE for license or visit https://github.com/taocpp/PEGTL/ #ifndef TAO_PEGTL_UINT32_HPP @@ -20,19 +20,19 @@ namespace tao // clang-format off struct any : internal::any< internal::peek_uint32_be > {}; - template< std::uint32_t... Cs > struct not_one : internal::one< internal::result_on_found::FAILURE, internal::peek_uint32_be, Cs... > {}; - template< std::uint32_t Lo, std::uint32_t Hi > struct not_range : internal::range< internal::result_on_found::FAILURE, internal::peek_uint32_be, Lo, Hi > {}; - template< std::uint32_t... Cs > struct one : internal::one< internal::result_on_found::SUCCESS, internal::peek_uint32_be, Cs... > {}; - template< std::uint32_t Lo, std::uint32_t Hi > struct range : internal::range< internal::result_on_found::SUCCESS, internal::peek_uint32_be, Lo, Hi > {}; + template< std::uint32_t... Cs > struct not_one : internal::one< internal::result_on_found::failure, internal::peek_uint32_be, Cs... > {}; + template< std::uint32_t Lo, std::uint32_t Hi > struct not_range : internal::range< internal::result_on_found::failure, internal::peek_uint32_be, Lo, Hi > {}; + template< std::uint32_t... Cs > struct one : internal::one< internal::result_on_found::success, internal::peek_uint32_be, Cs... > {}; + template< std::uint32_t Lo, std::uint32_t Hi > struct range : internal::range< internal::result_on_found::success, internal::peek_uint32_be, Lo, Hi > {}; template< std::uint32_t... Cs > struct ranges : internal::ranges< internal::peek_uint32_be, Cs... > {}; - template< std::uint32_t... Cs > struct string : internal::seq< internal::one< internal::result_on_found::SUCCESS, internal::peek_uint32_be, Cs >... > {}; + template< std::uint32_t... Cs > struct string : internal::seq< internal::one< internal::result_on_found::success, internal::peek_uint32_be, Cs >... > {}; - template< std::uint32_t M, std::uint32_t... Cs > struct mask_not_one : internal::one< internal::result_on_found::FAILURE, internal::peek_mask_uint32_be< M >, Cs... > {}; - template< std::uint32_t M, std::uint32_t Lo, std::uint32_t Hi > struct mask_not_range : internal::range< internal::result_on_found::FAILURE, internal::peek_mask_uint32_be< M >, Lo, Hi > {}; - template< std::uint32_t M, std::uint32_t... Cs > struct mask_one : internal::one< internal::result_on_found::SUCCESS, internal::peek_mask_uint32_be< M >, Cs... > {}; - template< std::uint32_t M, std::uint32_t Lo, std::uint32_t Hi > struct mask_range : internal::range< internal::result_on_found::SUCCESS, internal::peek_mask_uint32_be< M >, Lo, Hi > {}; + template< std::uint32_t M, std::uint32_t... Cs > struct mask_not_one : internal::one< internal::result_on_found::failure, internal::peek_mask_uint32_be< M >, Cs... > {}; + template< std::uint32_t M, std::uint32_t Lo, std::uint32_t Hi > struct mask_not_range : internal::range< internal::result_on_found::failure, internal::peek_mask_uint32_be< M >, Lo, Hi > {}; + template< std::uint32_t M, std::uint32_t... Cs > struct mask_one : internal::one< internal::result_on_found::success, internal::peek_mask_uint32_be< M >, Cs... > {}; + template< std::uint32_t M, std::uint32_t Lo, std::uint32_t Hi > struct mask_range : internal::range< internal::result_on_found::success, internal::peek_mask_uint32_be< M >, Lo, Hi > {}; template< std::uint32_t M, std::uint32_t... Cs > struct mask_ranges : internal::ranges< internal::peek_mask_uint32_be< M >, Cs... > {}; - template< std::uint32_t M, std::uint32_t... Cs > struct mask_string : internal::seq< internal::one< internal::result_on_found::SUCCESS, internal::peek_mask_uint32_be< M >, Cs >... > {}; + template< std::uint32_t M, std::uint32_t... Cs > struct mask_string : internal::seq< internal::one< internal::result_on_found::success, internal::peek_mask_uint32_be< M >, Cs >... > {}; // clang-format on } // namespace uint32_be @@ -42,19 +42,19 @@ namespace tao // clang-format off struct any : internal::any< internal::peek_uint32_le > {}; - template< std::uint32_t... Cs > struct not_one : internal::one< internal::result_on_found::FAILURE, internal::peek_uint32_le, Cs... > {}; - template< std::uint32_t Lo, std::uint32_t Hi > struct not_range : internal::range< internal::result_on_found::FAILURE, internal::peek_uint32_le, Lo, Hi > {}; - template< std::uint32_t... Cs > struct one : internal::one< internal::result_on_found::SUCCESS, internal::peek_uint32_le, Cs... > {}; - template< std::uint32_t Lo, std::uint32_t Hi > struct range : internal::range< internal::result_on_found::SUCCESS, internal::peek_uint32_le, Lo, Hi > {}; + template< std::uint32_t... Cs > struct not_one : internal::one< internal::result_on_found::failure, internal::peek_uint32_le, Cs... > {}; + template< std::uint32_t Lo, std::uint32_t Hi > struct not_range : internal::range< internal::result_on_found::failure, internal::peek_uint32_le, Lo, Hi > {}; + template< std::uint32_t... Cs > struct one : internal::one< internal::result_on_found::success, internal::peek_uint32_le, Cs... > {}; + template< std::uint32_t Lo, std::uint32_t Hi > struct range : internal::range< internal::result_on_found::success, internal::peek_uint32_le, Lo, Hi > {}; template< std::uint32_t... Cs > struct ranges : internal::ranges< internal::peek_uint32_le, Cs... > {}; - template< std::uint32_t... Cs > struct string : internal::seq< internal::one< internal::result_on_found::SUCCESS, internal::peek_uint32_le, Cs >... > {}; + template< std::uint32_t... Cs > struct string : internal::seq< internal::one< internal::result_on_found::success, internal::peek_uint32_le, Cs >... > {}; - template< std::uint32_t M, std::uint32_t... Cs > struct mask_not_one : internal::one< internal::result_on_found::FAILURE, internal::peek_mask_uint32_le< M >, Cs... > {}; - template< std::uint32_t M, std::uint32_t Lo, std::uint32_t Hi > struct mask_not_range : internal::range< internal::result_on_found::FAILURE, internal::peek_mask_uint32_le< M >, Lo, Hi > {}; - template< std::uint32_t M, std::uint32_t... Cs > struct mask_one : internal::one< internal::result_on_found::SUCCESS, internal::peek_mask_uint32_le< M >, Cs... > {}; - template< std::uint32_t M, std::uint32_t Lo, std::uint32_t Hi > struct mask_range : internal::range< internal::result_on_found::SUCCESS, internal::peek_mask_uint32_le< M >, Lo, Hi > {}; + template< std::uint32_t M, std::uint32_t... Cs > struct mask_not_one : internal::one< internal::result_on_found::failure, internal::peek_mask_uint32_le< M >, Cs... > {}; + template< std::uint32_t M, std::uint32_t Lo, std::uint32_t Hi > struct mask_not_range : internal::range< internal::result_on_found::failure, internal::peek_mask_uint32_le< M >, Lo, Hi > {}; + template< std::uint32_t M, std::uint32_t... Cs > struct mask_one : internal::one< internal::result_on_found::success, internal::peek_mask_uint32_le< M >, Cs... > {}; + template< std::uint32_t M, std::uint32_t Lo, std::uint32_t Hi > struct mask_range : internal::range< internal::result_on_found::success, internal::peek_mask_uint32_le< M >, Lo, Hi > {}; template< std::uint32_t M, std::uint32_t... Cs > struct mask_ranges : internal::ranges< internal::peek_mask_uint32_le< M >, Cs... > {}; - template< std::uint32_t M, std::uint32_t... Cs > struct mask_string : internal::seq< internal::one< internal::result_on_found::SUCCESS, internal::peek_mask_uint32_le< M >, Cs >... > {}; + template< std::uint32_t M, std::uint32_t... Cs > struct mask_string : internal::seq< internal::one< internal::result_on_found::success, internal::peek_mask_uint32_le< M >, Cs >... > {}; // clang-format on } // namespace uint32_le diff --git a/thirdparty/PEGTL/include/tao/pegtl/uint64.hpp b/thirdparty/PEGTL/include/tao/pegtl/uint64.hpp old mode 100644 new mode 100755 index f6d2f7c..732c0b5 --- a/thirdparty/PEGTL/include/tao/pegtl/uint64.hpp +++ b/thirdparty/PEGTL/include/tao/pegtl/uint64.hpp @@ -1,4 +1,4 @@ -// Copyright (c) 2018 Dr. Colin Hirsch and Daniel Frey +// Copyright (c) 2018-2019 Dr. Colin Hirsch and Daniel Frey // Please see LICENSE for license or visit https://github.com/taocpp/PEGTL/ #ifndef TAO_PEGTL_UINT64_HPP @@ -20,20 +20,20 @@ namespace tao // clang-format off struct any : internal::any< internal::peek_uint64_be > {}; - template< std::uint64_t... Cs > struct not_one : internal::one< internal::result_on_found::FAILURE, internal::peek_uint64_be, Cs... > {}; - template< std::uint64_t Lo, std::uint64_t Hi > struct not_range : internal::range< internal::result_on_found::FAILURE, internal::peek_uint64_be, Lo, Hi > {}; - template< std::uint64_t... Cs > struct one : internal::one< internal::result_on_found::SUCCESS, internal::peek_uint64_be, Cs... > {}; - template< std::uint64_t Lo, std::uint64_t Hi > struct range : internal::range< internal::result_on_found::SUCCESS, internal::peek_uint64_be, Lo, Hi > {}; + template< std::uint64_t... Cs > struct not_one : internal::one< internal::result_on_found::failure, internal::peek_uint64_be, Cs... > {}; + template< std::uint64_t Lo, std::uint64_t Hi > struct not_range : internal::range< internal::result_on_found::failure, internal::peek_uint64_be, Lo, Hi > {}; + template< std::uint64_t... Cs > struct one : internal::one< internal::result_on_found::success, internal::peek_uint64_be, Cs... > {}; + template< std::uint64_t Lo, std::uint64_t Hi > struct range : internal::range< internal::result_on_found::success, internal::peek_uint64_be, Lo, Hi > {}; template< std::uint64_t... Cs > struct ranges : internal::ranges< internal::peek_uint64_be, Cs... > {}; - template< std::uint64_t... Cs > struct string : internal::seq< internal::one< internal::result_on_found::SUCCESS, internal::peek_uint64_be, Cs >... > {}; + template< std::uint64_t... Cs > struct string : internal::seq< internal::one< internal::result_on_found::success, internal::peek_uint64_be, Cs >... > {}; - template< std::uint64_t M, std::uint64_t... Cs > struct mask_not_one : internal::one< internal::result_on_found::FAILURE, internal::peek_mask_uint64_be< M >, Cs... > {}; - template< std::uint64_t M, std::uint64_t Lo, std::uint64_t Hi > struct mask_not_range : internal::range< internal::result_on_found::FAILURE, internal::peek_mask_uint64_be< M >, Lo, Hi > {}; - template< std::uint64_t M, std::uint64_t... Cs > struct mask_one : internal::one< internal::result_on_found::SUCCESS, internal::peek_mask_uint64_be< M >, Cs... > {}; - template< std::uint64_t M, std::uint64_t Lo, std::uint64_t Hi > struct mask_range : internal::range< internal::result_on_found::SUCCESS, internal::peek_mask_uint64_be< M >, Lo, Hi > {}; + template< std::uint64_t M, std::uint64_t... Cs > struct mask_not_one : internal::one< internal::result_on_found::failure, internal::peek_mask_uint64_be< M >, Cs... > {}; + template< std::uint64_t M, std::uint64_t Lo, std::uint64_t Hi > struct mask_not_range : internal::range< internal::result_on_found::failure, internal::peek_mask_uint64_be< M >, Lo, Hi > {}; + template< std::uint64_t M, std::uint64_t... Cs > struct mask_one : internal::one< internal::result_on_found::success, internal::peek_mask_uint64_be< M >, Cs... > {}; + template< std::uint64_t M, std::uint64_t Lo, std::uint64_t Hi > struct mask_range : internal::range< internal::result_on_found::success, internal::peek_mask_uint64_be< M >, Lo, Hi > {}; template< std::uint64_t M, std::uint64_t... Cs > struct mask_ranges : internal::ranges< internal::peek_mask_uint64_be< M >, Cs... > {}; - template< std::uint64_t M, std::uint64_t... Cs > struct mask_string : internal::seq< internal::one< internal::result_on_found::SUCCESS, internal::peek_mask_uint64_be< M >, Cs >... > {}; + template< std::uint64_t M, std::uint64_t... Cs > struct mask_string : internal::seq< internal::one< internal::result_on_found::success, internal::peek_mask_uint64_be< M >, Cs >... > {}; // clang-format on } // namespace uint64_be @@ -43,19 +43,19 @@ namespace tao // clang-format off struct any : internal::any< internal::peek_uint64_le > {}; - template< std::uint64_t... Cs > struct not_one : internal::one< internal::result_on_found::FAILURE, internal::peek_uint64_le, Cs... > {}; - template< std::uint64_t Lo, std::uint64_t Hi > struct not_range : internal::range< internal::result_on_found::FAILURE, internal::peek_uint64_le, Lo, Hi > {}; - template< std::uint64_t... Cs > struct one : internal::one< internal::result_on_found::SUCCESS, internal::peek_uint64_le, Cs... > {}; - template< std::uint64_t Lo, std::uint64_t Hi > struct range : internal::range< internal::result_on_found::SUCCESS, internal::peek_uint64_le, Lo, Hi > {}; + template< std::uint64_t... Cs > struct not_one : internal::one< internal::result_on_found::failure, internal::peek_uint64_le, Cs... > {}; + template< std::uint64_t Lo, std::uint64_t Hi > struct not_range : internal::range< internal::result_on_found::failure, internal::peek_uint64_le, Lo, Hi > {}; + template< std::uint64_t... Cs > struct one : internal::one< internal::result_on_found::success, internal::peek_uint64_le, Cs... > {}; + template< std::uint64_t Lo, std::uint64_t Hi > struct range : internal::range< internal::result_on_found::success, internal::peek_uint64_le, Lo, Hi > {}; template< std::uint64_t... Cs > struct ranges : internal::ranges< internal::peek_uint64_le, Cs... > {}; - template< std::uint64_t... Cs > struct string : internal::seq< internal::one< internal::result_on_found::SUCCESS, internal::peek_uint64_le, Cs >... > {}; + template< std::uint64_t... Cs > struct string : internal::seq< internal::one< internal::result_on_found::success, internal::peek_uint64_le, Cs >... > {}; - template< std::uint64_t M, std::uint64_t... Cs > struct mask_not_one : internal::one< internal::result_on_found::FAILURE, internal::peek_mask_uint64_le< M >, Cs... > {}; - template< std::uint64_t M, std::uint64_t Lo, std::uint64_t Hi > struct mask_not_range : internal::range< internal::result_on_found::FAILURE, internal::peek_mask_uint64_le< M >, Lo, Hi > {}; - template< std::uint64_t M, std::uint64_t... Cs > struct mask_one : internal::one< internal::result_on_found::SUCCESS, internal::peek_mask_uint64_le< M >, Cs... > {}; - template< std::uint64_t M, std::uint64_t Lo, std::uint64_t Hi > struct mask_range : internal::range< internal::result_on_found::SUCCESS, internal::peek_mask_uint64_le< M >, Lo, Hi > {}; + template< std::uint64_t M, std::uint64_t... Cs > struct mask_not_one : internal::one< internal::result_on_found::failure, internal::peek_mask_uint64_le< M >, Cs... > {}; + template< std::uint64_t M, std::uint64_t Lo, std::uint64_t Hi > struct mask_not_range : internal::range< internal::result_on_found::failure, internal::peek_mask_uint64_le< M >, Lo, Hi > {}; + template< std::uint64_t M, std::uint64_t... Cs > struct mask_one : internal::one< internal::result_on_found::success, internal::peek_mask_uint64_le< M >, Cs... > {}; + template< std::uint64_t M, std::uint64_t Lo, std::uint64_t Hi > struct mask_range : internal::range< internal::result_on_found::success, internal::peek_mask_uint64_le< M >, Lo, Hi > {}; template< std::uint64_t M, std::uint64_t... Cs > struct mask_ranges : internal::ranges< internal::peek_mask_uint64_le< M >, Cs... > {}; - template< std::uint64_t M, std::uint64_t... Cs > struct mask_string : internal::seq< internal::one< internal::result_on_found::SUCCESS, internal::peek_mask_uint64_le< M >, Cs >... > {}; + template< std::uint64_t M, std::uint64_t... Cs > struct mask_string : internal::seq< internal::one< internal::result_on_found::success, internal::peek_mask_uint64_le< M >, Cs >... > {}; // clang-format on } // namespace uint64_le diff --git a/thirdparty/PEGTL/include/tao/pegtl/uint8.hpp b/thirdparty/PEGTL/include/tao/pegtl/uint8.hpp old mode 100644 new mode 100755 index 694c40b..af7a93d --- a/thirdparty/PEGTL/include/tao/pegtl/uint8.hpp +++ b/thirdparty/PEGTL/include/tao/pegtl/uint8.hpp @@ -1,4 +1,4 @@ -// Copyright (c) 2018 Dr. Colin Hirsch and Daniel Frey +// Copyright (c) 2018-2019 Dr. Colin Hirsch and Daniel Frey // Please see LICENSE for license or visit https://github.com/taocpp/PEGTL/ #ifndef TAO_PEGTL_UINT8_HPP @@ -20,19 +20,19 @@ namespace tao // clang-format off struct any : internal::any< internal::peek_uint8 > {}; - template< std::uint8_t... Cs > struct not_one : internal::one< internal::result_on_found::FAILURE, internal::peek_uint8, Cs... > {}; - template< std::uint8_t Lo, std::uint8_t Hi > struct not_range : internal::range< internal::result_on_found::FAILURE, internal::peek_uint8, Lo, Hi > {}; - template< std::uint8_t... Cs > struct one : internal::one< internal::result_on_found::SUCCESS, internal::peek_uint8, Cs... > {}; - template< std::uint8_t Lo, std::uint8_t Hi > struct range : internal::range< internal::result_on_found::SUCCESS, internal::peek_uint8, Lo, Hi > {}; + template< std::uint8_t... Cs > struct not_one : internal::one< internal::result_on_found::failure, internal::peek_uint8, Cs... > {}; + template< std::uint8_t Lo, std::uint8_t Hi > struct not_range : internal::range< internal::result_on_found::failure, internal::peek_uint8, Lo, Hi > {}; + template< std::uint8_t... Cs > struct one : internal::one< internal::result_on_found::success, internal::peek_uint8, Cs... > {}; + template< std::uint8_t Lo, std::uint8_t Hi > struct range : internal::range< internal::result_on_found::success, internal::peek_uint8, Lo, Hi > {}; template< std::uint8_t... Cs > struct ranges : internal::ranges< internal::peek_uint8, Cs... > {}; - template< std::uint8_t... Cs > struct string : internal::seq< internal::one< internal::result_on_found::SUCCESS, internal::peek_uint8, Cs >... > {}; + template< std::uint8_t... Cs > struct string : internal::seq< internal::one< internal::result_on_found::success, internal::peek_uint8, Cs >... > {}; - template< std::uint8_t M, std::uint8_t... Cs > struct mask_not_one : internal::one< internal::result_on_found::FAILURE, internal::peek_mask_uint8< M >, Cs... > {}; - template< std::uint8_t M, std::uint8_t Lo, std::uint8_t Hi > struct mask_not_range : internal::range< internal::result_on_found::FAILURE, internal::peek_mask_uint8< M >, Lo, Hi > {}; - template< std::uint8_t M, std::uint8_t... Cs > struct mask_one : internal::one< internal::result_on_found::SUCCESS, internal::peek_mask_uint8< M >, Cs... > {}; - template< std::uint8_t M, std::uint8_t Lo, std::uint8_t Hi > struct mask_range : internal::range< internal::result_on_found::SUCCESS, internal::peek_mask_uint8< M >, Lo, Hi > {}; + template< std::uint8_t M, std::uint8_t... Cs > struct mask_not_one : internal::one< internal::result_on_found::failure, internal::peek_mask_uint8< M >, Cs... > {}; + template< std::uint8_t M, std::uint8_t Lo, std::uint8_t Hi > struct mask_not_range : internal::range< internal::result_on_found::failure, internal::peek_mask_uint8< M >, Lo, Hi > {}; + template< std::uint8_t M, std::uint8_t... Cs > struct mask_one : internal::one< internal::result_on_found::success, internal::peek_mask_uint8< M >, Cs... > {}; + template< std::uint8_t M, std::uint8_t Lo, std::uint8_t Hi > struct mask_range : internal::range< internal::result_on_found::success, internal::peek_mask_uint8< M >, Lo, Hi > {}; template< std::uint8_t M, std::uint8_t... Cs > struct mask_ranges : internal::ranges< internal::peek_mask_uint8< M >, Cs... > {}; - template< std::uint8_t M, std::uint8_t... Cs > struct mask_string : internal::seq< internal::one< internal::result_on_found::SUCCESS, internal::peek_mask_uint8< M >, Cs >... > {}; + template< std::uint8_t M, std::uint8_t... Cs > struct mask_string : internal::seq< internal::one< internal::result_on_found::success, internal::peek_mask_uint8< M >, Cs >... > {}; // clang-format on } // namespace uint8 diff --git a/thirdparty/PEGTL/include/tao/pegtl/utf16.hpp b/thirdparty/PEGTL/include/tao/pegtl/utf16.hpp old mode 100644 new mode 100755 index cb47597..1238f10 --- a/thirdparty/PEGTL/include/tao/pegtl/utf16.hpp +++ b/thirdparty/PEGTL/include/tao/pegtl/utf16.hpp @@ -1,4 +1,4 @@ -// Copyright (c) 2015-2018 Dr. Colin Hirsch and Daniel Frey +// Copyright (c) 2015-2019 Dr. Colin Hirsch and Daniel Frey // Please see LICENSE for license or visit https://github.com/taocpp/PEGTL/ #ifndef TAO_PEGTL_UTF16_HPP @@ -18,13 +18,13 @@ namespace tao { // clang-format off struct any : internal::any< internal::peek_utf16_be > {}; - struct bom : internal::one< internal::result_on_found::SUCCESS, internal::peek_utf16_be, 0xfeff > {}; - template< char32_t... Cs > struct not_one : internal::one< internal::result_on_found::FAILURE, internal::peek_utf16_be, Cs... > {}; - template< char32_t Lo, char32_t Hi > struct not_range : internal::range< internal::result_on_found::FAILURE, internal::peek_utf16_be, Lo, Hi > {}; - template< char32_t... Cs > struct one : internal::one< internal::result_on_found::SUCCESS, internal::peek_utf16_be, Cs... > {}; - template< char32_t Lo, char32_t Hi > struct range : internal::range< internal::result_on_found::SUCCESS, internal::peek_utf16_be, Lo, Hi > {}; + struct bom : internal::one< internal::result_on_found::success, internal::peek_utf16_be, 0xfeff > {}; + template< char32_t... Cs > struct not_one : internal::one< internal::result_on_found::failure, internal::peek_utf16_be, Cs... > {}; + template< char32_t Lo, char32_t Hi > struct not_range : internal::range< internal::result_on_found::failure, internal::peek_utf16_be, Lo, Hi > {}; + template< char32_t... Cs > struct one : internal::one< internal::result_on_found::success, internal::peek_utf16_be, Cs... > {}; + template< char32_t Lo, char32_t Hi > struct range : internal::range< internal::result_on_found::success, internal::peek_utf16_be, Lo, Hi > {}; template< char32_t... Cs > struct ranges : internal::ranges< internal::peek_utf16_be, Cs... > {}; - template< char32_t... Cs > struct string : internal::seq< internal::one< internal::result_on_found::SUCCESS, internal::peek_utf16_be, Cs >... > {}; + template< char32_t... Cs > struct string : internal::seq< internal::one< internal::result_on_found::success, internal::peek_utf16_be, Cs >... > {}; // clang-format on } // namespace utf16_be @@ -33,13 +33,13 @@ namespace tao { // clang-format off struct any : internal::any< internal::peek_utf16_le > {}; - struct bom : internal::one< internal::result_on_found::SUCCESS, internal::peek_utf16_le, 0xfeff > {}; - template< char32_t... Cs > struct not_one : internal::one< internal::result_on_found::FAILURE, internal::peek_utf16_le, Cs... > {}; - template< char32_t Lo, char32_t Hi > struct not_range : internal::range< internal::result_on_found::FAILURE, internal::peek_utf16_le, Lo, Hi > {}; - template< char32_t... Cs > struct one : internal::one< internal::result_on_found::SUCCESS, internal::peek_utf16_le, Cs... > {}; - template< char32_t Lo, char32_t Hi > struct range : internal::range< internal::result_on_found::SUCCESS, internal::peek_utf16_le, Lo, Hi > {}; + struct bom : internal::one< internal::result_on_found::success, internal::peek_utf16_le, 0xfeff > {}; + template< char32_t... Cs > struct not_one : internal::one< internal::result_on_found::failure, internal::peek_utf16_le, Cs... > {}; + template< char32_t Lo, char32_t Hi > struct not_range : internal::range< internal::result_on_found::failure, internal::peek_utf16_le, Lo, Hi > {}; + template< char32_t... Cs > struct one : internal::one< internal::result_on_found::success, internal::peek_utf16_le, Cs... > {}; + template< char32_t Lo, char32_t Hi > struct range : internal::range< internal::result_on_found::success, internal::peek_utf16_le, Lo, Hi > {}; template< char32_t... Cs > struct ranges : internal::ranges< internal::peek_utf16_le, Cs... > {}; - template< char32_t... Cs > struct string : internal::seq< internal::one< internal::result_on_found::SUCCESS, internal::peek_utf16_le, Cs >... > {}; + template< char32_t... Cs > struct string : internal::seq< internal::one< internal::result_on_found::success, internal::peek_utf16_le, Cs >... > {}; // clang-format on } // namespace utf16_le diff --git a/thirdparty/PEGTL/include/tao/pegtl/utf32.hpp b/thirdparty/PEGTL/include/tao/pegtl/utf32.hpp old mode 100644 new mode 100755 index 34e102f..8a41d8e --- a/thirdparty/PEGTL/include/tao/pegtl/utf32.hpp +++ b/thirdparty/PEGTL/include/tao/pegtl/utf32.hpp @@ -1,4 +1,4 @@ -// Copyright (c) 2014-2018 Dr. Colin Hirsch and Daniel Frey +// Copyright (c) 2014-2019 Dr. Colin Hirsch and Daniel Frey // Please see LICENSE for license or visit https://github.com/taocpp/PEGTL/ #ifndef TAO_PEGTL_UTF32_HPP @@ -18,13 +18,13 @@ namespace tao { // clang-format off struct any : internal::any< internal::peek_utf32_be > {}; - struct bom : internal::one< internal::result_on_found::SUCCESS, internal::peek_utf32_be, 0xfeff > {}; - template< char32_t... Cs > struct not_one : internal::one< internal::result_on_found::FAILURE, internal::peek_utf32_be, Cs... > {}; - template< char32_t Lo, char32_t Hi > struct not_range : internal::range< internal::result_on_found::FAILURE, internal::peek_utf32_be, Lo, Hi > {}; - template< char32_t... Cs > struct one : internal::one< internal::result_on_found::SUCCESS, internal::peek_utf32_be, Cs... > {}; - template< char32_t Lo, char32_t Hi > struct range : internal::range< internal::result_on_found::SUCCESS, internal::peek_utf32_be, Lo, Hi > {}; + struct bom : internal::one< internal::result_on_found::success, internal::peek_utf32_be, 0xfeff > {}; + template< char32_t... Cs > struct not_one : internal::one< internal::result_on_found::failure, internal::peek_utf32_be, Cs... > {}; + template< char32_t Lo, char32_t Hi > struct not_range : internal::range< internal::result_on_found::failure, internal::peek_utf32_be, Lo, Hi > {}; + template< char32_t... Cs > struct one : internal::one< internal::result_on_found::success, internal::peek_utf32_be, Cs... > {}; + template< char32_t Lo, char32_t Hi > struct range : internal::range< internal::result_on_found::success, internal::peek_utf32_be, Lo, Hi > {}; template< char32_t... Cs > struct ranges : internal::ranges< internal::peek_utf32_be, Cs... > {}; - template< char32_t... Cs > struct string : internal::seq< internal::one< internal::result_on_found::SUCCESS, internal::peek_utf32_be, Cs >... > {}; + template< char32_t... Cs > struct string : internal::seq< internal::one< internal::result_on_found::success, internal::peek_utf32_be, Cs >... > {}; // clang-format on } // namespace utf32_be @@ -33,13 +33,13 @@ namespace tao { // clang-format off struct any : internal::any< internal::peek_utf32_le > {}; - struct bom : internal::one< internal::result_on_found::SUCCESS, internal::peek_utf32_le, 0xfeff > {}; - template< char32_t... Cs > struct not_one : internal::one< internal::result_on_found::FAILURE, internal::peek_utf32_le, Cs... > {}; - template< char32_t Lo, char32_t Hi > struct not_range : internal::range< internal::result_on_found::FAILURE, internal::peek_utf32_le, Lo, Hi > {}; - template< char32_t... Cs > struct one : internal::one< internal::result_on_found::SUCCESS, internal::peek_utf32_le, Cs... > {}; - template< char32_t Lo, char32_t Hi > struct range : internal::range< internal::result_on_found::SUCCESS, internal::peek_utf32_le, Lo, Hi > {}; + struct bom : internal::one< internal::result_on_found::success, internal::peek_utf32_le, 0xfeff > {}; + template< char32_t... Cs > struct not_one : internal::one< internal::result_on_found::failure, internal::peek_utf32_le, Cs... > {}; + template< char32_t Lo, char32_t Hi > struct not_range : internal::range< internal::result_on_found::failure, internal::peek_utf32_le, Lo, Hi > {}; + template< char32_t... Cs > struct one : internal::one< internal::result_on_found::success, internal::peek_utf32_le, Cs... > {}; + template< char32_t Lo, char32_t Hi > struct range : internal::range< internal::result_on_found::success, internal::peek_utf32_le, Lo, Hi > {}; template< char32_t... Cs > struct ranges : internal::ranges< internal::peek_utf32_le, Cs... > {}; - template< char32_t... Cs > struct string : internal::seq< internal::one< internal::result_on_found::SUCCESS, internal::peek_utf32_le, Cs >... > {}; + template< char32_t... Cs > struct string : internal::seq< internal::one< internal::result_on_found::success, internal::peek_utf32_le, Cs >... > {}; // clang-format on } // namespace utf32_le diff --git a/thirdparty/PEGTL/include/tao/pegtl/utf8.hpp b/thirdparty/PEGTL/include/tao/pegtl/utf8.hpp old mode 100644 new mode 100755 index c76e83e..1986cf9 --- a/thirdparty/PEGTL/include/tao/pegtl/utf8.hpp +++ b/thirdparty/PEGTL/include/tao/pegtl/utf8.hpp @@ -1,4 +1,4 @@ -// Copyright (c) 2014-2018 Dr. Colin Hirsch and Daniel Frey +// Copyright (c) 2014-2019 Dr. Colin Hirsch and Daniel Frey // Please see LICENSE for license or visit https://github.com/taocpp/PEGTL/ #ifndef TAO_PEGTL_UTF8_HPP @@ -18,13 +18,13 @@ namespace tao { // clang-format off struct any : internal::any< internal::peek_utf8 > {}; - struct bom : internal::one< internal::result_on_found::SUCCESS, internal::peek_utf8, 0xfeff > {}; - template< char32_t... Cs > struct not_one : internal::one< internal::result_on_found::FAILURE, internal::peek_utf8, Cs... > {}; - template< char32_t Lo, char32_t Hi > struct not_range : internal::range< internal::result_on_found::FAILURE, internal::peek_utf8, Lo, Hi > {}; - template< char32_t... Cs > struct one : internal::one< internal::result_on_found::SUCCESS, internal::peek_utf8, Cs... > {}; - template< char32_t Lo, char32_t Hi > struct range : internal::range< internal::result_on_found::SUCCESS, internal::peek_utf8, Lo, Hi > {}; + struct bom : internal::one< internal::result_on_found::success, internal::peek_utf8, 0xfeff > {}; + template< char32_t... Cs > struct not_one : internal::one< internal::result_on_found::failure, internal::peek_utf8, Cs... > {}; + template< char32_t Lo, char32_t Hi > struct not_range : internal::range< internal::result_on_found::failure, internal::peek_utf8, Lo, Hi > {}; + template< char32_t... Cs > struct one : internal::one< internal::result_on_found::success, internal::peek_utf8, Cs... > {}; + template< char32_t Lo, char32_t Hi > struct range : internal::range< internal::result_on_found::success, internal::peek_utf8, Lo, Hi > {}; template< char32_t... Cs > struct ranges : internal::ranges< internal::peek_utf8, Cs... > {}; - template< char32_t... Cs > struct string : internal::seq< internal::one< internal::result_on_found::SUCCESS, internal::peek_utf8, Cs >... > {}; + template< char32_t... Cs > struct string : internal::seq< internal::one< internal::result_on_found::success, internal::peek_utf8, Cs >... > {}; // clang-format on } // namespace utf8 diff --git a/thirdparty/PEGTL/include/tao/pegtl/version.hpp b/thirdparty/PEGTL/include/tao/pegtl/version.hpp old mode 100644 new mode 100755 index 491c38b..439da55 --- a/thirdparty/PEGTL/include/tao/pegtl/version.hpp +++ b/thirdparty/PEGTL/include/tao/pegtl/version.hpp @@ -1,16 +1,16 @@ -// Copyright (c) 2017-2018 Dr. Colin Hirsch and Daniel Frey +// Copyright (c) 2017-2019 Dr. Colin Hirsch and Daniel Frey // Please see LICENSE for license or visit https://github.com/taocpp/PEGTL/ #ifndef TAO_PEGTL_VERSION_HPP #define TAO_PEGTL_VERSION_HPP -#define TAO_PEGTL_VERSION "2.7.1" +#define TAO_PEGTL_VERSION "2.8.1" #define TAO_PEGTL_VERSION_MAJOR 2 -#define TAO_PEGTL_VERSION_MINOR 7 +#define TAO_PEGTL_VERSION_MINOR 8 #define TAO_PEGTL_VERSION_PATCH 1 -// Compatibility, remove with 3.0 +// Compatibility, remove with 3.0.0 #define TAOCPP_PEGTL_VERSION TAO_PEGTL_VERSION #define TAOCPP_PEGTL_VERSION_MAJOR TAO_PEGTL_VERSION_MAJOR #define TAOCPP_PEGTL_VERSION_MINOR TAO_PEGTL_VERSION_MINOR