From 7c0d378df31db9fa35052486cb198a3db310ac25 Mon Sep 17 00:00:00 2001 From: Stephane Del Pino <stephane.delpino44@gmail.com> Date: Sat, 11 Apr 2020 00:54:12 +0200 Subject: [PATCH] git subrepo pull packages/PEGTL subrepo: subdir: "packages/PEGTL" merged: "83b6cdc71" upstream: origin: "git@github.com:taocpp/PEGTL.git" branch: "master" commit: "83b6cdc71" git-subrepo: version: "0.4.1" origin: "git@github.com:ingydotnet/git-subrepo.git" commit: "a04d8c2" --- packages/PEGTL/.clang-tidy | 1 + packages/PEGTL/.gitrepo | 4 +- packages/PEGTL/.travis.yml | 230 ++++++------------ packages/PEGTL/README.md | 13 +- packages/PEGTL/doc/Changelog.md | 6 + packages/PEGTL/doc/Installing-and-Using.md | 75 ++---- packages/PEGTL/doc/README.md | 1 + .../tao/pegtl/analysis/analyze_cycles.hpp | 3 +- .../include/tao/pegtl/analysis/counted.hpp | 3 +- .../include/tao/pegtl/analysis/generic.hpp | 3 +- .../tao/pegtl/analysis/insert_guard.hpp | 3 +- .../tao/pegtl/analysis/insert_rules.hpp | 25 -- .../include/tao/pegtl/analysis/rule_info.hpp | 3 +- .../PEGTL/include/tao/pegtl/argv_input.hpp | 6 +- .../include/tao/pegtl/contrib/icu/utf16.hpp | 12 +- .../include/tao/pegtl/contrib/icu/utf32.hpp | 12 +- .../include/tao/pegtl/contrib/icu/utf8.hpp | 6 +- .../include/tao/pegtl/contrib/if_then.hpp | 6 +- .../include/tao/pegtl/contrib/parse_tree.hpp | 128 +++++----- .../include/tao/pegtl/contrib/raw_string.hpp | 3 +- .../tao/pegtl/contrib/rep_one_min_max.hpp | 6 +- .../include/tao/pegtl/contrib/rep_string.hpp | 3 +- .../PEGTL/include/tao/pegtl/cstream_input.hpp | 3 +- .../tao/pegtl/internal/action_input.hpp | 3 +- .../tao/pegtl/internal/always_false.hpp | 3 +- .../tao/pegtl/internal/cstream_reader.hpp | 2 +- .../tao/pegtl/internal/file_mapper_posix.hpp | 3 +- .../tao/pegtl/internal/file_mapper_win32.hpp | 12 +- .../tao/pegtl/internal/file_opener.hpp | 3 +- .../tao/pegtl/internal/file_reader.hpp | 6 +- .../tao/pegtl/internal/istream_reader.hpp | 3 +- .../include/tao/pegtl/internal/istring.hpp | 3 +- .../include/tao/pegtl/internal/iterator.hpp | 6 +- .../include/tao/pegtl/internal/marker.hpp | 6 +- .../include/tao/pegtl/internal/ranges.hpp | 3 +- .../include/tao/pegtl/internal/require.hpp | 3 +- .../PEGTL/include/tao/pegtl/internal/seq.hpp | 3 +- .../PEGTL/include/tao/pegtl/internal/sor.hpp | 6 +- .../include/tao/pegtl/internal/string.hpp | 3 +- .../PEGTL/include/tao/pegtl/istream_input.hpp | 3 +- .../PEGTL/include/tao/pegtl/memory_input.hpp | 58 ++--- .../PEGTL/include/tao/pegtl/mmap_input.hpp | 6 +- packages/PEGTL/include/tao/pegtl/normal.hpp | 15 +- packages/PEGTL/include/tao/pegtl/nothing.hpp | 3 +- .../PEGTL/include/tao/pegtl/parse_error.hpp | 9 +- packages/PEGTL/include/tao/pegtl/position.hpp | 6 +- .../PEGTL/include/tao/pegtl/read_input.hpp | 9 +- packages/PEGTL/include/tao/pegtl/rules.hpp | 4 +- .../PEGTL/include/tao/pegtl/string_input.hpp | 6 +- .../PEGTL/src/example/pegtl/abnf2pegtl.cpp | 4 +- packages/PEGTL/src/example/pegtl/analyze.cpp | 6 +- .../src/example/pegtl/chomsky_hierarchy.cpp | 18 +- packages/PEGTL/src/example/pegtl/csv1.cpp | 3 +- .../PEGTL/src/example/pegtl/json_build.cpp | 3 +- .../PEGTL/src/example/pegtl/json_classes.hpp | 21 +- .../PEGTL/src/example/pegtl/modulus_match.cpp | 3 +- packages/PEGTL/src/test/pegtl/actions_one.cpp | 18 +- packages/PEGTL/src/test/pegtl/actions_two.cpp | 6 +- .../PEGTL/src/test/pegtl/contrib_http.cpp | 3 +- .../src/test/pegtl/contrib_parse_tree.cpp | 3 +- .../src/test/pegtl/contrib_raw_string.cpp | 6 +- .../PEGTL/src/test/pegtl/data_cstring.cpp | 6 +- .../PEGTL/src/test/pegtl/file_cstream.cpp | 12 +- .../PEGTL/src/test/pegtl/file_istream.cpp | 12 +- packages/PEGTL/src/test/pegtl/file_read.cpp | 6 +- .../PEGTL/src/test/pegtl/pegtl_string_t.cpp | 12 +- packages/PEGTL/src/test/pegtl/position.cpp | 3 +- packages/PEGTL/src/test/pegtl/rule_state.cpp | 6 +- packages/PEGTL/src/test/pegtl/verify_file.hpp | 6 +- packages/PEGTL/src/test/pegtl/verify_rule.hpp | 6 +- 70 files changed, 338 insertions(+), 567 deletions(-) delete mode 100644 packages/PEGTL/include/tao/pegtl/analysis/insert_rules.hpp diff --git a/packages/PEGTL/.clang-tidy b/packages/PEGTL/.clang-tidy index 592618ff6..14eb1216c 100644 --- a/packages/PEGTL/.clang-tidy +++ b/packages/PEGTL/.clang-tidy @@ -16,6 +16,7 @@ Checks: >- -modernize-avoid-c-arrays, -modernize-concat-nested-namespaces, -modernize-raw-string-literal, + -modernize-use-trailing-return-type, performance-*, readability-*, -readability-avoid-const-params-in-decls, diff --git a/packages/PEGTL/.gitrepo b/packages/PEGTL/.gitrepo index 57a70bcf7..76f9ade4d 100644 --- a/packages/PEGTL/.gitrepo +++ b/packages/PEGTL/.gitrepo @@ -6,7 +6,7 @@ [subrepo] remote = git@github.com:taocpp/PEGTL.git branch = master - commit = bbe0c12c0d6203a962b29fbb38f332f7f3131ef0 - parent = 4e529e65898e54ed3e91b9ef0b8d11371f05ca92 + commit = 83b6cdc717b68a3714e6c76e13dbc4a571b491c1 + parent = 6a6f7b2c81c10365515dc8302a829ba6200d27b0 cmdver = 0.4.1 method = merge diff --git a/packages/PEGTL/.travis.yml b/packages/PEGTL/.travis.yml index b276d70b5..4164eefa4 100644 --- a/packages/PEGTL/.travis.yml +++ b/packages/PEGTL/.travis.yml @@ -2,126 +2,120 @@ language: generic os: linux dist: xenial -matrix: +jobs: include: - - compiler: gcc + - &gcc-7 + compiler: gcc addons: apt: - sources: ['ubuntu-toolchain-r-test'] - packages: ['g++-7'] + sources: [ ubuntu-toolchain-r-test ] + packages: [ g++-7 ] env: - CXX=g++-7 - - compiler: gcc + - &gcc-8 + compiler: gcc addons: apt: - sources: ['ubuntu-toolchain-r-test'] - packages: ['g++-8'] + sources: [ ubuntu-toolchain-r-test ] + packages: [ g++-8 ] env: - CXX=g++-8 - - compiler: gcc - addons: - apt: - sources: ['ubuntu-toolchain-r-test'] - packages: ['g++-8'] + - <<: *gcc-8 env: - CXX=g++-8 - - CPPFLAGS=-fno-rtti + - CPPFLAGS="-fno-rtti" - - compiler: gcc + - &gcc-9 + compiler: gcc addons: apt: - sources: ['ubuntu-toolchain-r-test'] - packages: ['g++-9'] + sources: [ ubuntu-toolchain-r-test ] + packages: [ g++-9 ] env: - CXX=g++-9 - compiler: clang addons: apt: - sources: ['ubuntu-toolchain-r-test', 'llvm-toolchain-xenial-5'] - packages: ['clang-5.0', 'g++-7'] + sources: [ ubuntu-toolchain-r-test, llvm-toolchain-xenial-5 ] + packages: [ clang-5.0, g++-7 ] env: - CXX=clang++-5.0 - compiler: clang addons: apt: - sources: ['ubuntu-toolchain-r-test', 'llvm-toolchain-xenial-6'] - packages: ['clang-6.0', 'g++-7'] + sources: [ ubuntu-toolchain-r-test, llvm-toolchain-xenial-6 ] + packages: [ clang-6.0, g++-7 ] env: - CXX=clang++-6.0 - compiler: clang addons: apt: - sources: ['ubuntu-toolchain-r-test', 'llvm-toolchain-xenial-7'] - packages: ['clang-7', 'g++-7'] + sources: [ ubuntu-toolchain-r-test, llvm-toolchain-xenial-7 ] + packages: [ clang-7, g++-7 ] env: - CXX=clang++-7 - compiler: clang addons: apt: - sources: ['ubuntu-toolchain-r-test', 'llvm-toolchain-xenial-8'] - packages: ['clang-8', 'g++-8'] + sources: [ ubuntu-toolchain-r-test, llvm-toolchain-xenial-8 ] + packages: [ clang-8, g++-8 ] env: - CXX=clang++-8 - compiler: clang addons: apt: - sources: ['ubuntu-toolchain-r-test', 'llvm-toolchain-xenial-8'] - packages: ['clang-8', 'g++-8'] + sources: &clang-9-sources + - ubuntu-toolchain-r-test + - sourceline: deb https://apt.llvm.org/xenial/ llvm-toolchain-xenial-9 main + key_url: https://apt.llvm.org/llvm-snapshot.gpg.key + packages: [ clang-9, g++-9 ] env: - - CXX=clang++-8 - - CPPFLAGS=-fms-extensions + - CXX=clang++-9 - - compiler: clang + - &clang-10 + compiler: clang addons: apt: - sources: ['ubuntu-toolchain-r-test', 'llvm-toolchain-xenial-8'] - packages: ['clang-8', 'g++-8'] + sources: &clang-10-sources + - ubuntu-toolchain-r-test + - sourceline: deb https://apt.llvm.org/xenial/ llvm-toolchain-xenial-10 main + key_url: https://apt.llvm.org/llvm-snapshot.gpg.key + packages: [ clang-10, g++-9 ] env: - - CXX=clang++-8 - - CPPFLAGS=-fno-rtti + - CXX=clang++-10 - - compiler: clang - addons: - apt: - sources: - - ubuntu-toolchain-r-test - - sourceline: 'deb https://apt.llvm.org/xenial/ llvm-toolchain-xenial-9 main' - key_url: 'https://apt.llvm.org/llvm-snapshot.gpg.key' - packages: - - clang-9 - - g++-9 + - <<: *clang-10 env: - - CXX=clang++-9 + - CXX=clang++-10 + - CPPFLAGS="-fms-extensions" + + - <<: *clang-10 + env: + - CXX=clang++-10 + - CPPFLAGS="-fno-rtti" - - os: osx + - &osx + os: osx osx_image: xcode9.4 compiler: clang env: - CXX=clang++ - - os: osx + - <<: *osx osx_image: xcode10.3 - compiler: clang - env: - - CXX=clang++ - - os: osx + - <<: *osx osx_image: xcode11.3 - compiler: clang - env: - - CXX=clang++ - - compiler: clang - env: - - ANDROID_ABI=armeabi-v7a - - ANDROID_PLATFORM=android-22 + - &android + compiler: clang addons: apt: packages: @@ -131,149 +125,85 @@ matrix: - wget https://dl.google.com/android/repository/sdk-tools-linux-4333796.zip - unzip -qq sdk-tools-linux-4333796.zip -d /opt/android-sdk - rm sdk-tools-linux-4333796.zip - - echo "y" | /opt/android-sdk/tools/bin/sdkmanager "platform-tools" "system-images;android-24;default;armeabi-v7a" "platforms;android-24" "emulator" "ndk-bundle" "cmake;3.10.2.4988404" > /dev/null + - echo "y" | /opt/android-sdk/tools/bin/sdkmanager "platform-tools" "system-images;android-24;default;${ANDROID_ABI}" "platforms;android-24" "emulator" "ndk-bundle" "cmake;3.10.2.4988404" > /dev/null before_script: - export TERM=dumb - export _NO_CHECK_SIGNATURE=true - export ANDROID_SDK_ROOT=/opt/android-sdk - - echo no | /opt/android-sdk/tools/bin/avdmanager create avd -n test -k "system-images;android-24;default;armeabi-v7a" + - echo no | /opt/android-sdk/tools/bin/avdmanager create avd -n test -k "system-images;android-24;default;${ANDROID_ABI}" - /opt/android-sdk/emulator/emulator -avd test -no-audio -no-window -dns-server 8.8.8.8 & #- android-wait-for-emulator || android-wait-for-emulator - /opt/android-sdk/platform-tools/adb shell input keyevent 82 & script: # Using the ninja build command. Is much faster then make build command. - - /opt/android-sdk/cmake/3.10.2.4988404/bin/cmake -H. -Bcmake-build -GNinja -DANDROID_ABI=armeabi-v7a -DCMAKE_BUILD_TYPE=Release -DCMAKE_TOOLCHAIN_FILE=/opt/android-sdk/ndk-bundle/build/cmake/android.toolchain.cmake -DANDROID_PLATFORM=android-22 -DCMAKE_MAKE_PROGRAM=/opt/android-sdk/cmake/3.10.2.4988404/bin/ninja -DPEGTL_BUILD_EXAMPLES=OFF + - /opt/android-sdk/cmake/3.10.2.4988404/bin/cmake -H. -Bcmake-build -GNinja -DANDROID_ABI=${ANDROID_ABI} -DCMAKE_BUILD_TYPE=Release -DCMAKE_TOOLCHAIN_FILE=/opt/android-sdk/ndk-bundle/build/cmake/android.toolchain.cmake -DANDROID_PLATFORM=${ANDROID_PLATFORM} -DCMAKE_MAKE_PROGRAM=/opt/android-sdk/cmake/3.10.2.4988404/bin/ninja -DPEGTL_BUILD_EXAMPLES=OFF - /opt/android-sdk/cmake/3.10.2.4988404/bin/cmake --build cmake-build --target all # FIXME android emulator stuck sometimes - cd cmake-build && /opt/android-sdk/cmake/3.10.2.4988404/bin/ctest --output-on-failure + env: + - ANDROID_ABI=armeabi-v7a + - ANDROID_PLATFORM=android-22 - - compiler: clang + - <<: *android env: - ANDROID_ABI=armeabi-v7a - ANDROID_PLATFORM=android-24 - addons: - apt: - packages: - - openjdk-8-jdk - before_install: - - export JAVA_HOME=/usr/lib/jvm/java-8-openjdk-amd64 - - wget https://dl.google.com/android/repository/sdk-tools-linux-4333796.zip - - unzip -qq sdk-tools-linux-4333796.zip -d /opt/android-sdk - - rm sdk-tools-linux-4333796.zip - - echo "y" | /opt/android-sdk/tools/bin/sdkmanager "platform-tools" "system-images;android-24;default;armeabi-v7a" "platforms;android-24" "emulator" "ndk-bundle" "cmake;3.10.2.4988404" > /dev/null - before_script: - - export TERM=dumb - - export _NO_CHECK_SIGNATURE=true - - export ANDROID_SDK_ROOT=/opt/android-sdk - - echo no | /opt/android-sdk/tools/bin/avdmanager create avd -n test -k "system-images;android-24;default;armeabi-v7a" - - /opt/android-sdk/emulator/emulator -avd test -no-audio -no-window -dns-server 8.8.8.8 & - #- android-wait-for-emulator || android-wait-for-emulator - - /opt/android-sdk/platform-tools/adb shell input keyevent 82 & - script: - # Using the ninja build command. Is much faster then make build command. - - /opt/android-sdk/cmake/3.10.2.4988404/bin/cmake -H. -Bcmake-build -GNinja -DANDROID_ABI=armeabi-v7a -DCMAKE_BUILD_TYPE=Release -DCMAKE_TOOLCHAIN_FILE=/opt/android-sdk/ndk-bundle/build/cmake/android.toolchain.cmake -DANDROID_PLATFORM=android-24 -DCMAKE_MAKE_PROGRAM=/opt/android-sdk/cmake/3.10.2.4988404/bin/ninja -DPEGTL_BUILD_EXAMPLES=OFF - - /opt/android-sdk/cmake/3.10.2.4988404/bin/cmake --build cmake-build --target all - # FIXME android emulator stuck sometimes - cd cmake-build && /opt/android-sdk/cmake/3.10.2.4988404/bin/ctest --output-on-failure - - compiler: clang + - <<: *android env: - ANDROID_ABI=arm64-v8a - ANDROID_PLATFORM=android-24 - addons: - apt: - packages: - - openjdk-8-jdk - before_install: - - export JAVA_HOME=/usr/lib/jvm/java-8-openjdk-amd64 - - wget https://dl.google.com/android/repository/sdk-tools-linux-4333796.zip - - unzip -qq sdk-tools-linux-4333796.zip -d /opt/android-sdk - - rm sdk-tools-linux-4333796.zip - - echo "y" | /opt/android-sdk/tools/bin/sdkmanager "platform-tools" "system-images;android-24;default;arm64-v8a" "platforms;android-24" "emulator" "ndk-bundle" "cmake;3.10.2.4988404" > /dev/null - before_script: - - export TERM=dumb - - export _NO_CHECK_SIGNATURE=true - - export ANDROID_SDK_ROOT=/opt/android-sdk - - echo no | /opt/android-sdk/tools/bin/avdmanager create avd -n test -k "system-images;android-24;default;arm64-v8a" - - /opt/android-sdk/emulator/emulator -avd test -no-audio -no-window -dns-server 8.8.8.8 & - #- android-wait-for-emulator || android-wait-for-emulator - - /opt/android-sdk/platform-tools/adb shell input keyevent 82 & - script: - # Using the ninja build command. Is much faster then make build command. - - /opt/android-sdk/cmake/3.10.2.4988404/bin/cmake -H. -Bcmake-build -GNinja -DANDROID_ABI=arm64-v8a -DCMAKE_BUILD_TYPE=Release -DCMAKE_TOOLCHAIN_FILE=/opt/android-sdk/ndk-bundle/build/cmake/android.toolchain.cmake -DANDROID_PLATFORM=android-24 -DCMAKE_MAKE_PROGRAM=/opt/android-sdk/cmake/3.10.2.4988404/bin/ninja -DPEGTL_BUILD_EXAMPLES=OFF - - /opt/android-sdk/cmake/3.10.2.4988404/bin/cmake --build cmake-build --target all - # FIXME android emulator stuck sometimes- cd cmake-build && /opt/android-sdk/cmake/3.10.2.4988404/bin/ctest --output-on-failure - - compiler: gcc - addons: - apt: - sources: ['ubuntu-toolchain-r-test'] - packages: ['g++-9'] + - <<: *gcc-9 env: - CXX=g++-9 - CPPFLAGS="-fsanitize=undefined -fuse-ld=gold" - - compiler: gcc - sudo: true - addons: - apt: - sources: ['ubuntu-toolchain-r-test'] - packages: ['g++-9'] + - <<: *gcc-9 env: - CXX=g++-9 - CPPFLAGS="-fsanitize=address -fuse-ld=gold" - - compiler: clang - addons: - apt: - sources: ['ubuntu-toolchain-r-test', 'llvm-toolchain-xenial-8'] - packages: ['clang-8', 'g++-8'] + - <<: *clang-10 env: - - CXX=clang++-8 - - CPPFLAGS=-fsanitize=undefined + - CXX=clang++-10 + - CPPFLAGS="-fsanitize=undefined" - - compiler: clang - sudo: true - addons: - apt: - sources: ['ubuntu-toolchain-r-test', 'llvm-toolchain-xenial-8'] - packages: ['clang-8', 'g++-8'] + - <<: *clang-10 env: - - CXX=clang++-8 - - CPPFLAGS=-fsanitize=address + - CXX=clang++-10 + - CPPFLAGS="-fsanitize=address" - compiler: clang addons: apt: - sources: ['ubuntu-toolchain-r-test', 'llvm-toolchain-xenial-8'] - packages: ['clang-8', 'clang-tidy-8', 'g++-8'] + sources: *clang-10-sources + packages: [ clang-10, clang-tidy-10, g++-9 ] env: - - CLANG_TIDY=clang-tidy-8 + - CXX=clang++-10 + - CLANG_TIDY=clang-tidy-10 script: - make -kj3 clang-tidy - compiler: clang addons: apt: - sources: ['ubuntu-toolchain-r-test', 'llvm-toolchain-xenial-8'] - packages: ['clang-8', 'clang-tools-8', 'g++-8'] + sources: *clang-10-sources + packages: [ clang-tools-10, g++-9 ] script: - - scan-build-8 --use-c++=clang++-8 --status-bugs make -kj3 + - scan-build-10 --use-c++=clang++-10 --status-bugs make -kj3 - compiler: gcc addons: apt: - sources: ['ubuntu-toolchain-r-test'] - packages: ['g++-9', 'valgrind'] + sources: [ ubuntu-toolchain-r-test ] + packages: [ g++-9, valgrind ] env: - CXX=g++-9 - SPECIAL=valgrind script: - make -kj3 valgrind - - compiler: gcc - addons: - apt: - sources: ['ubuntu-toolchain-r-test'] - packages: ['g++-7'] + - <<: *gcc-7 env: - CXX=g++-7 - CXXFLAGS="-O0 --coverage" @@ -286,10 +216,10 @@ matrix: - compiler: clang addons: apt: - sources: ['ubuntu-toolchain-r-test', 'llvm-toolchain-xenial-8'] - packages: ['clang-format-8', 'g++-8'] + sources: *clang-9-sources + packages: [ clang-format-9, g++-9 ] script: - - clang-format-8 -i -style=file $(find . -name '[^.]*.[hc]pp') + - clang-format-9 -i -style=file $(find . -name '[^.]*.[hc]pp') - git diff --exit-code script: diff --git a/packages/PEGTL/README.md b/packages/PEGTL/README.md index 1f8a3df3b..e7d168d60 100644 --- a/packages/PEGTL/README.md +++ b/packages/PEGTL/README.md @@ -67,12 +67,12 @@ Each commit is automatically tested with multiple architectures, operating syste * macOS 10.13, Xcode 9.4 * macOS 10.14, Xcode 10.3 - * macOS 10.14, Xcode 11.2 + * macOS 10.14, Xcode 11.3 * Ubuntu 16.04 LTS (using libstdc++) * GCC 7.x, 8.x, 9.x - * Clang 5.x, 6.x, 7.x, 8.x, 9.x + * Clang 5.x, 6.x, 7.x, 8.x, 9.x, 10.x 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). @@ -81,15 +81,6 @@ Code coverage is automatically measured and the unit tests cover 100% of the cor Incompatible API changes are *only* allowed to occur between major versions. For details see the [changelog](doc/Changelog.md). -## Package Managers - -You can download and install the PEGTL using the [Conan](https://github.com/conan-io/conan) package manager: - - conan install taocpp-pegtl/2.8.1@ - -The taocpp-pegtl package in conan is kept up to date by Conan team members and community contributors. -If the version is out-of-date, please [create an issue or pull request](https://github.com/conan-io/conan-center-index) on the Conan Center Index repository. - ## Thank You 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. diff --git a/packages/PEGTL/doc/Changelog.md b/packages/PEGTL/doc/Changelog.md index d1e9c0d74..25c9c3738 100644 --- a/packages/PEGTL/doc/Changelog.md +++ b/packages/PEGTL/doc/Changelog.md @@ -26,6 +26,12 @@ * Refactored parse tree type storage/handling. * Removes the need for RTTI. +## 2.8.2 + +Released 2020-04-05 + +* Fixed parse tree node generation to correctly remove intermediate nodes. + ## 2.8.1 Released 2019-08-06 diff --git a/packages/PEGTL/doc/Installing-and-Using.md b/packages/PEGTL/doc/Installing-and-Using.md index 8338d8d36..ec4302e13 100644 --- a/packages/PEGTL/doc/Installing-and-Using.md +++ b/packages/PEGTL/doc/Installing-and-Using.md @@ -4,14 +4,12 @@ * [Requirements](#requirements) * [Installation Packages](#installation-packages) +* [Using Conan](#using-conan) * [Using CMake](#using-cmake) * [CMake Installation](#cmake-installation) * [`find_package`](#find_package) * [`add_subdirectory`](#add_subdirectory) * [Mixing `find_package` and `add_subdirectory`](#mixing-find_package-and-add_subdirectory) -* [Conan](#conan) - * [Using a development version](#using-a-development-version) - * [Developing with conan editable](#developing-with-conan-editable) * [Manual Installation](#manual-installation) * [Embedding the PEGTL](#embedding-the-pegtl) * [Embedding in Binaries](#embedding-in-binaries) @@ -45,14 +43,27 @@ the `-pedantic`, `-Wall`, `-Wextra` and `-Werror` compiler switches. ## Installation Packages -Installation packages are available from several package managers. Note that some of the listed packages are not updated regularly. +Installation packages are available from several package managers. +Note that some of the listed packages are not updated regularly. [](https://repology.org/metapackage/pegtl) -### Other +## Using Conan -* [Conan] -* [Spack] +You can download and install the PEGTL using the [Conan] package manager: + +```bash +conan install taocpp-pegtl/<version>@ +``` + +where `<version>` is the version of the PEGTL you want to use. + +The `taocpp-pegtl` package in Conan is kept up to date by Conan team members +and community contributors. If the version is out-of-date, please +[create an issue or pull request](https://github.com/conan-io/conan-center-index) +on the Conan Center Index repository. + +For more options and ways to use Conan, please refer to the [Conan documentation]. ## Using CMake @@ -117,8 +128,8 @@ are also defined. ### Mixing `find_package` and `add_subdirectory` With the advent of improved methods of managing dependencies (such as [Conan], -[Spack], [CMake FetchContent]), multiple package inclusion methods needs to be -able to co-exist. +[CMake FetchContent]), multiple package inclusion methods needs to be able to +co-exist. If PEGTL was first included with `find_package` then subsequent calls to `add_subdirectory(path/to/PEGTL)` will skip over the body of the @@ -135,42 +146,7 @@ two different versions of PEGTL simultaneously and signalling a fatal error becomes the only practical way of handling the inclusion of multiple different PEGTL versions. -For more options and ways to use CMake, please refer to the -[CMake documentation]. - -Conan ---- - -The [PEGTL conan package](https://bintray.com/conan/conan-center/taocpp-pegtl%3A_) is updated by Conan Center Index. - -Simply add - -```ini -pegtl/<version>@ -``` - -as a dependency to your conan project where `<version>` is the version of PEGTL you want to use. - -### Developing with conan editable - -If it is required to develop PEGTL alongside another library/application then the package can be put into editable mode with - -```bash -conan editable add . pegtl/<version>@ -``` - -If the editable layout has `[builddirs]` set correctly and one is using the `cmake_paths` or `cmake`generator - -```cmake -find_package(pegtl) -``` - -will work as expected. It will find the editable package and add it to the current CMake project. An editable package implies that it is under development so tests and examples will be automatically built unless `PEGTL_BUILD_TESTS` and `PEGTL_BUILD_EXAMPLES` are turned off. - -Caveats with the editable package: - -- Currently, if the package is included with `CONAN_PKG::pegtl` or used in a build system other than CMake then the tests and examples won't be built as the CMake config script is bypassed. -- CMake will compulsively rebuild tests and examples if the build directory is reconfigured from another directory. +For more options and ways to use CMake, please refer to the [CMake documentation]. ## Manual Installation @@ -269,12 +245,15 @@ In a Unix-shell, the following command will achieve this: $ make amalgamate ``` -The above will generate a `build/amalgamated/pegtl.hpp` which will consist of the headers `tao/pegtl.hpp`, `tao/pegtl/analyze.hpp`, their dependencies, and all headers in `tao/pegtl/contrib/` except for the headers in `tao/pegtl/contrib/icu/`. +The above will generate a `build/amalgamated/pegtl.hpp` which will consist of +the headers `tao/pegtl.hpp`, `tao/pegtl/analyze.hpp`, their dependencies, +and all headers in `tao/pegtl/contrib/` except for the headers in +`tao/pegtl/contrib/icu/`. Copyright (c) 2014-2020 Dr. Colin Hirsch and Daniel Frey +[Conan]: https://conan.io/ +[Conan documentation]: https://docs.conan.io/ [CMake]: https://cmake.org/ [CMake documentation]: https://cmake.org/documentation/ [CMake FetchContent]: https://cmake.org/cmake/help/latest/module/FetchContent.html -[Conan]: https://bintray.com/taocpp/public-conan/pegtl%3Ataocpp -[Spack]: http://spack.readthedocs.io/en/latest/package_list.html#pegtl diff --git a/packages/PEGTL/doc/README.md b/packages/PEGTL/doc/README.md index 2de138962..333592dd3 100644 --- a/packages/PEGTL/doc/README.md +++ b/packages/PEGTL/doc/README.md @@ -5,6 +5,7 @@ * [Installing and Using](Installing-and-Using.md) * [Requirements](Installing-and-Using.md#requirements) * [Installation Packages](Installing-and-Using.md#installation-packages) + * [Using Conan](Installing-and-Using.md#using-conan) * [Using CMake](Installing-and-Using.md#using-cmake) * [CMake Installation](Installing-and-Using.md#cmake-installation) * [`find_package`](Installing-and-Using.md#find_package) diff --git a/packages/PEGTL/include/tao/pegtl/analysis/analyze_cycles.hpp b/packages/PEGTL/include/tao/pegtl/analysis/analyze_cycles.hpp index e62cbcc2c..8b8e5d3da 100644 --- a/packages/PEGTL/include/tao/pegtl/analysis/analyze_cycles.hpp +++ b/packages/PEGTL/include/tao/pegtl/analysis/analyze_cycles.hpp @@ -27,8 +27,7 @@ namespace TAO_PEGTL_NAMESPACE::analysis explicit analyze_cycles_impl( const bool verbose ) noexcept : m_verbose( verbose ), m_problems( 0 ) - { - } + {} const bool m_verbose; unsigned m_problems; diff --git a/packages/PEGTL/include/tao/pegtl/analysis/counted.hpp b/packages/PEGTL/include/tao/pegtl/analysis/counted.hpp index face1897a..63773db19 100644 --- a/packages/PEGTL/include/tao/pegtl/analysis/counted.hpp +++ b/packages/PEGTL/include/tao/pegtl/analysis/counted.hpp @@ -15,8 +15,7 @@ namespace TAO_PEGTL_NAMESPACE::analysis template< rule_type Type, std::size_t Count, typename... Rules > struct counted : generic< ( Count != 0 ) ? Type : rule_type::opt, Rules... > - { - }; + {}; } // namespace TAO_PEGTL_NAMESPACE::analysis diff --git a/packages/PEGTL/include/tao/pegtl/analysis/generic.hpp b/packages/PEGTL/include/tao/pegtl/analysis/generic.hpp index 17c002be8..ddf3a9c9a 100644 --- a/packages/PEGTL/include/tao/pegtl/analysis/generic.hpp +++ b/packages/PEGTL/include/tao/pegtl/analysis/generic.hpp @@ -7,7 +7,6 @@ #include "../config.hpp" #include "grammar_info.hpp" -#include "insert_rules.hpp" #include "rule_type.hpp" namespace TAO_PEGTL_NAMESPACE::analysis @@ -20,7 +19,7 @@ namespace TAO_PEGTL_NAMESPACE::analysis { const auto [ it, success ] = g.insert< Name >( Type ); if( success ) { - insert_rules< Rules... >::insert( g, it->second ); + ( it->second.rules.emplace_back( Rules::analyze_t::template insert< Rules >( g ) ), ... ); } return it->first; } diff --git a/packages/PEGTL/include/tao/pegtl/analysis/insert_guard.hpp b/packages/PEGTL/include/tao/pegtl/analysis/insert_guard.hpp index 727e976aa..5ced82dcd 100644 --- a/packages/PEGTL/include/tao/pegtl/analysis/insert_guard.hpp +++ b/packages/PEGTL/include/tao/pegtl/analysis/insert_guard.hpp @@ -17,8 +17,7 @@ namespace TAO_PEGTL_NAMESPACE::analysis insert_guard( C& container, const typename C::value_type& value ) : m_i( container.insert( value ) ), m_c( container ) - { - } + {} insert_guard( const insert_guard& ) = delete; insert_guard( insert_guard&& ) = delete; diff --git a/packages/PEGTL/include/tao/pegtl/analysis/insert_rules.hpp b/packages/PEGTL/include/tao/pegtl/analysis/insert_rules.hpp deleted file mode 100644 index 8f636e429..000000000 --- a/packages/PEGTL/include/tao/pegtl/analysis/insert_rules.hpp +++ /dev/null @@ -1,25 +0,0 @@ -// Copyright (c) 2014-2020 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 -#define TAO_PEGTL_ANALYSIS_INSERT_RULES_HPP - -#include "../config.hpp" - -#include "grammar_info.hpp" -#include "rule_info.hpp" - -namespace TAO_PEGTL_NAMESPACE::analysis -{ - template< typename... Rules > - struct insert_rules - { - static void insert( grammar_info& g, rule_info& r ) - { - ( r.rules.emplace_back( Rules::analyze_t::template insert< Rules >( g ) ), ... ); - } - }; - -} // namespace TAO_PEGTL_NAMESPACE::analysis - -#endif diff --git a/packages/PEGTL/include/tao/pegtl/analysis/rule_info.hpp b/packages/PEGTL/include/tao/pegtl/analysis/rule_info.hpp index 576163a1d..68dc18267 100644 --- a/packages/PEGTL/include/tao/pegtl/analysis/rule_info.hpp +++ b/packages/PEGTL/include/tao/pegtl/analysis/rule_info.hpp @@ -17,8 +17,7 @@ namespace TAO_PEGTL_NAMESPACE::analysis { explicit rule_info( const rule_type in_type ) noexcept : type( in_type ) - { - } + {} rule_type type; std::vector< std::string > rules; diff --git a/packages/PEGTL/include/tao/pegtl/argv_input.hpp b/packages/PEGTL/include/tao/pegtl/argv_input.hpp index f727442b8..741a3574d 100644 --- a/packages/PEGTL/include/tao/pegtl/argv_input.hpp +++ b/packages/PEGTL/include/tao/pegtl/argv_input.hpp @@ -34,13 +34,11 @@ namespace TAO_PEGTL_NAMESPACE template< typename T > argv_input( char** argv, const std::size_t argn, T&& in_source ) : memory_input< P, Eol >( static_cast< const char* >( argv[ argn ] ), std::forward< T >( in_source ) ) - { - } + {} argv_input( char** argv, const std::size_t argn ) : argv_input( argv, argn, internal::make_argv_source( argn ) ) - { - } + {} }; template< typename... Ts > diff --git a/packages/PEGTL/include/tao/pegtl/contrib/icu/utf16.hpp b/packages/PEGTL/include/tao/pegtl/contrib/icu/utf16.hpp index 24a8c23ce..bc5ee5436 100644 --- a/packages/PEGTL/include/tao/pegtl/contrib/icu/utf16.hpp +++ b/packages/PEGTL/include/tao/pegtl/contrib/icu/utf16.hpp @@ -18,14 +18,12 @@ namespace TAO_PEGTL_NAMESPACE template< UProperty P, bool V = true > struct binary_property : internal::icu::binary_property< internal::peek_utf16_be, P, V > - { - }; + {}; template< UProperty P, int V > struct property_value : internal::icu::property_value< internal::peek_utf16_be, P, V > - { - }; + {}; // clang-format off struct alphabetic : binary_property< UCHAR_ALPHABETIC > {}; @@ -109,14 +107,12 @@ namespace TAO_PEGTL_NAMESPACE template< UProperty P, bool V = true > struct binary_property : internal::icu::binary_property< internal::peek_utf16_le, P, V > - { - }; + {}; template< UProperty P, int V > struct property_value : internal::icu::property_value< internal::peek_utf16_le, P, V > - { - }; + {}; // clang-format off struct alphabetic : binary_property< UCHAR_ALPHABETIC > {}; diff --git a/packages/PEGTL/include/tao/pegtl/contrib/icu/utf32.hpp b/packages/PEGTL/include/tao/pegtl/contrib/icu/utf32.hpp index 9d9332308..54cfe071d 100644 --- a/packages/PEGTL/include/tao/pegtl/contrib/icu/utf32.hpp +++ b/packages/PEGTL/include/tao/pegtl/contrib/icu/utf32.hpp @@ -18,14 +18,12 @@ namespace TAO_PEGTL_NAMESPACE template< UProperty P, bool V = true > struct binary_property : internal::icu::binary_property< internal::peek_utf32_be, P, V > - { - }; + {}; template< UProperty P, int V > struct property_value : internal::icu::property_value< internal::peek_utf32_be, P, V > - { - }; + {}; // clang-format off struct alphabetic : binary_property< UCHAR_ALPHABETIC > {}; @@ -109,14 +107,12 @@ namespace TAO_PEGTL_NAMESPACE template< UProperty P, bool V = true > struct binary_property : internal::icu::binary_property< internal::peek_utf32_le, P, V > - { - }; + {}; template< UProperty P, int V > struct property_value : internal::icu::property_value< internal::peek_utf32_le, P, V > - { - }; + {}; // clang-format off struct alphabetic : binary_property< UCHAR_ALPHABETIC > {}; diff --git a/packages/PEGTL/include/tao/pegtl/contrib/icu/utf8.hpp b/packages/PEGTL/include/tao/pegtl/contrib/icu/utf8.hpp index 4df896778..aaf6838d3 100644 --- a/packages/PEGTL/include/tao/pegtl/contrib/icu/utf8.hpp +++ b/packages/PEGTL/include/tao/pegtl/contrib/icu/utf8.hpp @@ -16,14 +16,12 @@ namespace TAO_PEGTL_NAMESPACE::utf8::icu template< UProperty P, bool V = true > struct binary_property : internal::icu::binary_property< internal::peek_utf8, P, V > - { - }; + {}; template< UProperty P, int V > struct property_value : internal::icu::property_value< internal::peek_utf8, P, V > - { - }; + {}; // clang-format off struct alphabetic : binary_property< UCHAR_ALPHABETIC > {}; diff --git a/packages/PEGTL/include/tao/pegtl/contrib/if_then.hpp b/packages/PEGTL/include/tao/pegtl/contrib/if_then.hpp index fa50ccd8a..22e97247f 100644 --- a/packages/PEGTL/include/tao/pegtl/contrib/if_then.hpp +++ b/packages/PEGTL/include/tao/pegtl/contrib/if_then.hpp @@ -19,8 +19,7 @@ namespace TAO_PEGTL_NAMESPACE { template< typename Cond, typename Then > struct if_pair - { - }; + {}; template< typename... Pairs > struct if_then; @@ -39,8 +38,7 @@ namespace TAO_PEGTL_NAMESPACE template<> struct if_then<> : trivial< false > - { - }; + {}; template< typename... Pairs > inline constexpr bool skip_control< if_then< Pairs... > > = true; diff --git a/packages/PEGTL/include/tao/pegtl/contrib/parse_tree.hpp b/packages/PEGTL/include/tao/pegtl/contrib/parse_tree.hpp index a6f70b490..67bde63ed 100644 --- a/packages/PEGTL/include/tao/pegtl/contrib/parse_tree.hpp +++ b/packages/PEGTL/include/tao/pegtl/contrib/parse_tree.hpp @@ -24,7 +24,8 @@ #include "../analysis/generic.hpp" #include "../internal/demangle.hpp" #include "../internal/iterator.hpp" -#include "../internal/seq.hpp" +#include "../internal/skip_control.hpp" +#include "../internal/try_catch_type.hpp" namespace TAO_PEGTL_NAMESPACE::parse_tree { @@ -131,8 +132,7 @@ namespace TAO_PEGTL_NAMESPACE::parse_tree // if parsing of the rule failed, this method is called template< typename Rule, typename Input, typename... States > void failure( const Input& /*unused*/, States&&... /*unused*/ ) noexcept - { - } + {} // if parsing succeeded and the (optional) transform call // did not discard the node, it is appended to its parent. @@ -148,18 +148,17 @@ namespace TAO_PEGTL_NAMESPACE::parse_tree struct node : basic_node< node > - { - }; + {}; namespace internal { template< typename > - struct is_seq + struct is_try_catch_type : std::false_type {}; - template< typename... Rules > - struct is_seq< TAO_PEGTL_NAMESPACE::internal::seq< Rules... > > + template< typename Exception, typename... Rules > + struct is_try_catch_type< TAO_PEGTL_NAMESPACE::internal::try_catch_type< Exception, Rules... > > : std::true_type {}; @@ -193,8 +192,7 @@ namespace TAO_PEGTL_NAMESPACE::parse_tree template< typename Selector, typename... Parameters > void transform( Parameters&&... /*unused*/ ) noexcept - { - } + {} 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... ) ) ) @@ -213,47 +211,40 @@ namespace TAO_PEGTL_NAMESPACE::parse_tree template< unsigned Level, typename Analyse, template< typename... > class Selector > struct is_leaf : std::false_type - { - }; + {}; template< analysis::rule_type Type, template< typename... > class Selector > struct is_leaf< 0, analysis::generic< Type >, Selector > : std::true_type - { - }; + {}; 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 - { - }; + {}; template< analysis::rule_type Type, typename... Rules, template< typename... > class Selector > struct is_leaf< 0, analysis::generic< Type, Rules... >, Selector > : std::false_type - { - }; + {}; 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 - { - }; + {}; template< unsigned Level, typename Rule, template< typename... > class Selector > - inline constexpr bool is_unselected_leaf = !Selector< Rule >::value && is_leaf< Level, typename Rule::analyze_t, Selector >::value; + inline constexpr bool is_unselected_leaf = ( TAO_PEGTL_NAMESPACE::internal::skip_control< Rule > || !Selector< Rule >::value ) && is_leaf< Level, typename Rule::analyze_t, Selector >::value; template< unsigned Level, analysis::rule_type Type, typename... Rules, template< typename... > class Selector > struct is_leaf< Level, analysis::generic< Type, Rules... >, Selector > : std::bool_constant< ( is_unselected_leaf< Level - 1, Rules, 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 > : std::bool_constant< ( is_unselected_leaf< Level - 1, Rules, Selector > && ... ) > - { - }; + {}; template< typename T > struct control @@ -355,7 +346,7 @@ namespace TAO_PEGTL_NAMESPACE::parse_tree struct state_handler; template< typename Rule > - using type = control< state_handler< Rule, Selector< Rule >::value, is_leaf< 8, typename Rule::analyze_t, Selector >::value > >; + using type = control< state_handler< Rule, !TAO_PEGTL_NAMESPACE::internal::skip_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 > @@ -388,28 +379,62 @@ namespace TAO_PEGTL_NAMESPACE::parse_tree : Control< Rule > { template< typename Input, typename... States > - static void start( const Input& in, state< Node >& state, States&&... st ) + static void start( const Input& in, state< Node >& /*unused*/, States&&... st ) noexcept( noexcept( Control< Rule >::start( in, st... ) ) ) { Control< Rule >::start( in, st... ); - state.emplace_back(); } template< typename Input, typename... States > - static void success( const Input& in, state< Node >& state, States&&... st ) + static void success( const Input& in, state< Node >& /*unused*/, States&&... st ) noexcept( noexcept( Control< Rule >::success( in, st... ) ) ) { Control< Rule >::success( in, 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 failure( const Input& in, state< Node >& state, States&&... st ) noexcept( noexcept( Control< Rule >::failure( in, st... ) ) ) + static void failure( const Input& in, state< Node >& /*unused*/, States&&... st ) noexcept( noexcept( Control< Rule >::failure( in, st... ) ) ) { Control< Rule >::failure( in, st... ); - state.pop_back(); + } + + template< apply_mode A, + rewind_mode M, + template< typename... > + class Action, + template< typename... > + class Control2, + typename Input, + typename... States > + [[nodiscard]] static bool match( Input& in, States&&... st ) + { + auto& state = std::get< sizeof...( st ) - 1 >( std::tie( st... ) ); + if constexpr( is_try_catch_type< Rule >::value ) { + internal::state< Node > tmp; + tmp.emplace_back(); + tmp.stack.swap( state.stack ); + const bool result = Control< Rule >::template match< A, M, Action, Control2 >( in, st... ); + tmp.stack.swap( state.stack ); + if( result ) { + for( auto& c : tmp.back()->children ) { + state.back()->children.emplace_back( std::move( c ) ); + } + } + return result; + } + else { + state.emplace_back(); + const bool result = Control< Rule >::template match< A, M, Action, Control2 >( in, st... ); + if( result ) { + auto n = std::move( state.back() ); + state.pop_back(); + for( auto& c : n->children ) { + state.back()->children.emplace_back( std::move( c ) ); + } + } + else { + state.pop_back(); + } + return result; + } } }; @@ -446,37 +471,6 @@ namespace TAO_PEGTL_NAMESPACE::parse_tree state.back()->template failure< Rule >( in, st... ); state.pop_back(); } - - template< apply_mode A, - rewind_mode M, - template< typename... > - class Action, - template< typename... > - class Control2, - typename Input, - typename... States > - [[nodiscard]] static bool match( Input& in, States&&... st ) - { - if constexpr( is_seq< Rule >::value ) { - auto& state = std::get< sizeof...( st ) - 1 >( std::tie( st... ) ); - state.emplace_back(); - const bool result = Control< Rule >::template match< A, M, Action, Control2 >( in, st... ); - if( result ) { - auto n = std::move( state.back() ); - state.pop_back(); - for( auto& c : n->children ) { - state.back()->children.emplace_back( std::move( c ) ); - } - } - else { - state.pop_back(); - } - return result; - } - else { - return Control< Rule >::template match< A, M, Action, Control2 >( in, st... ); - } - } }; template< typename > diff --git a/packages/PEGTL/include/tao/pegtl/contrib/raw_string.hpp b/packages/PEGTL/include/tao/pegtl/contrib/raw_string.hpp index 92a62fee5..7c3c8eefb 100644 --- a/packages/PEGTL/include/tao/pegtl/contrib/raw_string.hpp +++ b/packages/PEGTL/include/tao/pegtl/contrib/raw_string.hpp @@ -196,8 +196,7 @@ namespace TAO_PEGTL_NAMESPACE // when a raw string is not closed properly or has invalid content. struct content : internal::raw_string_until< internal::at_raw_string_close< Marker, Close >, Contents... > - { - }; + {}; using analyze_t = typename internal::seq< internal::bytes< 1 >, content, internal::bytes< 1 > >::analyze_t; diff --git a/packages/PEGTL/include/tao/pegtl/contrib/rep_one_min_max.hpp b/packages/PEGTL/include/tao/pegtl/contrib/rep_one_min_max.hpp index ee8c7515b..f190edaab 100644 --- a/packages/PEGTL/include/tao/pegtl/contrib/rep_one_min_max.hpp +++ b/packages/PEGTL/include/tao/pegtl/contrib/rep_one_min_max.hpp @@ -51,9 +51,9 @@ namespace TAO_PEGTL_NAMESPACE inline namespace ascii { template< unsigned Min, unsigned Max, char C > - struct rep_one_min_max : internal::rep_one_min_max< Min, Max, C > - { - }; + struct rep_one_min_max + : internal::rep_one_min_max< Min, Max, C > + {}; } // namespace ascii diff --git a/packages/PEGTL/include/tao/pegtl/contrib/rep_string.hpp b/packages/PEGTL/include/tao/pegtl/contrib/rep_string.hpp index fd1607cd2..39796eef9 100644 --- a/packages/PEGTL/include/tao/pegtl/contrib/rep_string.hpp +++ b/packages/PEGTL/include/tao/pegtl/contrib/rep_string.hpp @@ -25,8 +25,7 @@ namespace TAO_PEGTL_NAMESPACE 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 diff --git a/packages/PEGTL/include/tao/pegtl/cstream_input.hpp b/packages/PEGTL/include/tao/pegtl/cstream_input.hpp index 54e62feef..cebc6f7aa 100644 --- a/packages/PEGTL/include/tao/pegtl/cstream_input.hpp +++ b/packages/PEGTL/include/tao/pegtl/cstream_input.hpp @@ -21,8 +21,7 @@ namespace TAO_PEGTL_NAMESPACE 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::string, Chunk >( std::forward< T >( in_source ), in_maximum, in_stream ) - { - } + {} }; template< typename... Ts > diff --git a/packages/PEGTL/include/tao/pegtl/internal/action_input.hpp b/packages/PEGTL/include/tao/pegtl/internal/action_input.hpp index 91b69de80..051b1753b 100644 --- a/packages/PEGTL/include/tao/pegtl/internal/action_input.hpp +++ b/packages/PEGTL/include/tao/pegtl/internal/action_input.hpp @@ -26,8 +26,7 @@ namespace TAO_PEGTL_NAMESPACE::internal action_input( const iterator_t& in_begin, const Input& in_input ) noexcept : m_begin( in_begin ), m_input( in_input ) - { - } + {} action_input( const action_input& ) = delete; action_input( action_input&& ) = delete; diff --git a/packages/PEGTL/include/tao/pegtl/internal/always_false.hpp b/packages/PEGTL/include/tao/pegtl/internal/always_false.hpp index 23d72dfa0..cfeb7d1c9 100644 --- a/packages/PEGTL/include/tao/pegtl/internal/always_false.hpp +++ b/packages/PEGTL/include/tao/pegtl/internal/always_false.hpp @@ -13,8 +13,7 @@ namespace TAO_PEGTL_NAMESPACE::internal template< typename... > struct always_false : std::false_type - { - }; + {}; } // namespace TAO_PEGTL_NAMESPACE::internal diff --git a/packages/PEGTL/include/tao/pegtl/internal/cstream_reader.hpp b/packages/PEGTL/include/tao/pegtl/internal/cstream_reader.hpp index f22fb08fa..5d46854c6 100644 --- a/packages/PEGTL/include/tao/pegtl/internal/cstream_reader.hpp +++ b/packages/PEGTL/include/tao/pegtl/internal/cstream_reader.hpp @@ -22,7 +22,7 @@ namespace TAO_PEGTL_NAMESPACE::internal assert( m_cstream != nullptr ); } - [[nodiscard]] std::size_t operator()( char* buffer, const std::size_t length ) + [[nodiscard]] std::size_t operator()( char* buffer, const std::size_t length ) const { if( const auto r = std::fread( buffer, 1, length, m_cstream ) ) { return r; diff --git a/packages/PEGTL/include/tao/pegtl/internal/file_mapper_posix.hpp b/packages/PEGTL/include/tao/pegtl/internal/file_mapper_posix.hpp index bf77dccaf..cd4b5663e 100644 --- a/packages/PEGTL/include/tao/pegtl/internal/file_mapper_posix.hpp +++ b/packages/PEGTL/include/tao/pegtl/internal/file_mapper_posix.hpp @@ -20,8 +20,7 @@ namespace TAO_PEGTL_NAMESPACE::internal public: explicit file_mapper( const char* filename ) : file_mapper( file_opener( filename ) ) - { - } + {} explicit file_mapper( const file_opener& reader ) : m_size( reader.size() ), diff --git a/packages/PEGTL/include/tao/pegtl/internal/file_mapper_win32.hpp b/packages/PEGTL/include/tao/pegtl/internal/file_mapper_win32.hpp index 80686ae3f..27f9eaf95 100644 --- a/packages/PEGTL/include/tao/pegtl/internal/file_mapper_win32.hpp +++ b/packages/PEGTL/include/tao/pegtl/internal/file_mapper_win32.hpp @@ -37,8 +37,7 @@ namespace TAO_PEGTL_NAMESPACE::internal explicit win32_file_opener( const char* filename ) : m_source( filename ), m_handle( open() ) - { - } + {} win32_file_opener( const win32_file_opener& ) = delete; win32_file_opener( win32_file_opener&& ) = delete; @@ -102,14 +101,12 @@ namespace TAO_PEGTL_NAMESPACE::internal { explicit win32_file_mapper( const char* filename ) : win32_file_mapper( win32_file_opener( filename ) ) - { - } + {} explicit win32_file_mapper( const win32_file_opener& reader ) : m_size( reader.size() ), m_handle( open( reader ) ) - { - } + {} win32_file_mapper( const win32_file_mapper& ) = delete; win32_file_mapper( win32_file_mapper&& ) = delete; @@ -153,8 +150,7 @@ namespace TAO_PEGTL_NAMESPACE::internal public: explicit file_mapper( const char* filename ) : file_mapper( win32_file_mapper( filename ) ) - { - } + {} explicit file_mapper( const win32_file_mapper& mapper ) : m_size( mapper.m_size ), diff --git a/packages/PEGTL/include/tao/pegtl/internal/file_opener.hpp b/packages/PEGTL/include/tao/pegtl/internal/file_opener.hpp index 801e735aa..5f2521b6b 100644 --- a/packages/PEGTL/include/tao/pegtl/internal/file_opener.hpp +++ b/packages/PEGTL/include/tao/pegtl/internal/file_opener.hpp @@ -21,8 +21,7 @@ namespace TAO_PEGTL_NAMESPACE::internal explicit file_opener( const char* filename ) : m_source( filename ), m_fd( open() ) - { - } + {} file_opener( const file_opener& ) = delete; file_opener( file_opener&& ) = delete; diff --git a/packages/PEGTL/include/tao/pegtl/internal/file_reader.hpp b/packages/PEGTL/include/tao/pegtl/internal/file_reader.hpp index 8c69d4dec..ac098e592 100644 --- a/packages/PEGTL/include/tao/pegtl/internal/file_reader.hpp +++ b/packages/PEGTL/include/tao/pegtl/internal/file_reader.hpp @@ -46,14 +46,12 @@ namespace TAO_PEGTL_NAMESPACE::internal explicit file_reader( const char* filename ) : m_source( filename ), m_file( file_open( m_source ) ) - { - } + {} file_reader( FILE* file, const char* filename ) noexcept : m_source( filename ), m_file( file ) - { - } + {} file_reader( const file_reader& ) = delete; file_reader( file_reader&& ) = delete; diff --git a/packages/PEGTL/include/tao/pegtl/internal/istream_reader.hpp b/packages/PEGTL/include/tao/pegtl/internal/istream_reader.hpp index 6d6016464..fa91b960d 100644 --- a/packages/PEGTL/include/tao/pegtl/internal/istream_reader.hpp +++ b/packages/PEGTL/include/tao/pegtl/internal/istream_reader.hpp @@ -15,8 +15,7 @@ namespace TAO_PEGTL_NAMESPACE::internal { explicit istream_reader( std::istream& s ) noexcept : m_istream( s ) - { - } + {} [[nodiscard]] std::size_t operator()( char* buffer, const std::size_t length ) { diff --git a/packages/PEGTL/include/tao/pegtl/internal/istring.hpp b/packages/PEGTL/include/tao/pegtl/internal/istring.hpp index e615fb168..bc0f76588 100644 --- a/packages/PEGTL/include/tao/pegtl/internal/istring.hpp +++ b/packages/PEGTL/include/tao/pegtl/internal/istring.hpp @@ -43,8 +43,7 @@ namespace TAO_PEGTL_NAMESPACE::internal template<> struct istring<> : trivial< true > - { - }; + {}; template< char... Cs > struct istring diff --git a/packages/PEGTL/include/tao/pegtl/internal/iterator.hpp b/packages/PEGTL/include/tao/pegtl/internal/iterator.hpp index c598f2146..416b53d00 100644 --- a/packages/PEGTL/include/tao/pegtl/internal/iterator.hpp +++ b/packages/PEGTL/include/tao/pegtl/internal/iterator.hpp @@ -16,16 +16,14 @@ namespace TAO_PEGTL_NAMESPACE::internal explicit iterator( const char* in_data ) noexcept : data( in_data ) - { - } + {} iterator( const char* in_data, const std::size_t in_byte, const std::size_t in_line, const std::size_t in_byte_in_line ) noexcept : data( in_data ), byte( in_byte ), line( in_line ), byte_in_line( in_byte_in_line ) - { - } + {} iterator( const iterator& ) = default; iterator( iterator&& ) = default; diff --git a/packages/PEGTL/include/tao/pegtl/internal/marker.hpp b/packages/PEGTL/include/tao/pegtl/internal/marker.hpp index bbecc7b33..27d4c0cf0 100644 --- a/packages/PEGTL/include/tao/pegtl/internal/marker.hpp +++ b/packages/PEGTL/include/tao/pegtl/internal/marker.hpp @@ -16,8 +16,7 @@ namespace TAO_PEGTL_NAMESPACE::internal static constexpr rewind_mode next_rewind_mode = M; explicit marker( const Iterator& /*unused*/ ) noexcept - { - } + {} marker( const marker& ) = delete; marker( marker&& ) = delete; @@ -42,8 +41,7 @@ namespace TAO_PEGTL_NAMESPACE::internal explicit marker( Iterator& i ) noexcept : m_saved( i ), m_input( &i ) - { - } + {} marker( const marker& ) = delete; marker( marker&& ) = delete; diff --git a/packages/PEGTL/include/tao/pegtl/internal/ranges.hpp b/packages/PEGTL/include/tao/pegtl/internal/ranges.hpp index 845274423..8aa01e70c 100644 --- a/packages/PEGTL/include/tao/pegtl/internal/ranges.hpp +++ b/packages/PEGTL/include/tao/pegtl/internal/ranges.hpp @@ -82,8 +82,7 @@ namespace TAO_PEGTL_NAMESPACE::internal 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 > - { - }; + {}; template< typename Peek, typename Peek::data_t... Cs > inline constexpr bool skip_control< ranges< Peek, Cs... > > = true; diff --git a/packages/PEGTL/include/tao/pegtl/internal/require.hpp b/packages/PEGTL/include/tao/pegtl/internal/require.hpp index 7ed38f59b..94e299a23 100644 --- a/packages/PEGTL/include/tao/pegtl/internal/require.hpp +++ b/packages/PEGTL/include/tao/pegtl/internal/require.hpp @@ -19,8 +19,7 @@ namespace TAO_PEGTL_NAMESPACE::internal template<> struct require< 0 > : trivial< true > - { - }; + {}; template< unsigned Amount > struct require diff --git a/packages/PEGTL/include/tao/pegtl/internal/seq.hpp b/packages/PEGTL/include/tao/pegtl/internal/seq.hpp index 65ee88afd..3779635b2 100644 --- a/packages/PEGTL/include/tao/pegtl/internal/seq.hpp +++ b/packages/PEGTL/include/tao/pegtl/internal/seq.hpp @@ -22,8 +22,7 @@ namespace TAO_PEGTL_NAMESPACE::internal template<> struct seq<> : trivial< true > - { - }; + {}; template< typename Rule > struct seq< Rule > diff --git a/packages/PEGTL/include/tao/pegtl/internal/sor.hpp b/packages/PEGTL/include/tao/pegtl/internal/sor.hpp index 8100d5dce..a26d466b6 100644 --- a/packages/PEGTL/include/tao/pegtl/internal/sor.hpp +++ b/packages/PEGTL/include/tao/pegtl/internal/sor.hpp @@ -24,14 +24,12 @@ namespace TAO_PEGTL_NAMESPACE::internal template<> struct sor<> : trivial< false > - { - }; + {}; template< typename... Rules > struct sor : sor< std::index_sequence_for< Rules... >, Rules... > - { - }; + {}; template< std::size_t... Indices, typename... Rules > struct sor< std::index_sequence< Indices... >, Rules... > diff --git a/packages/PEGTL/include/tao/pegtl/internal/string.hpp b/packages/PEGTL/include/tao/pegtl/internal/string.hpp index 142d33a14..b8ed2eedb 100644 --- a/packages/PEGTL/include/tao/pegtl/internal/string.hpp +++ b/packages/PEGTL/include/tao/pegtl/internal/string.hpp @@ -29,8 +29,7 @@ namespace TAO_PEGTL_NAMESPACE::internal template<> struct string<> : trivial< true > - { - }; + {}; template< char... Cs > struct string diff --git a/packages/PEGTL/include/tao/pegtl/istream_input.hpp b/packages/PEGTL/include/tao/pegtl/istream_input.hpp index 44e89f1ad..d9a967ef9 100644 --- a/packages/PEGTL/include/tao/pegtl/istream_input.hpp +++ b/packages/PEGTL/include/tao/pegtl/istream_input.hpp @@ -21,8 +21,7 @@ namespace TAO_PEGTL_NAMESPACE 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::string, Chunk >( std::forward< T >( in_source ), in_maximum, in_stream ) - { - } + {} }; template< typename... Ts > diff --git a/packages/PEGTL/include/tao/pegtl/memory_input.hpp b/packages/PEGTL/include/tao/pegtl/memory_input.hpp index 5f074c3cb..6c4c8c9a5 100644 --- a/packages/PEGTL/include/tao/pegtl/memory_input.hpp +++ b/packages/PEGTL/include/tao/pegtl/memory_input.hpp @@ -46,8 +46,7 @@ namespace TAO_PEGTL_NAMESPACE m_current( in_begin ), m_end( in_end ), m_source( std::forward< T >( in_source ) ) - { - } + {} template< typename T > memory_input_base( const char* in_begin, const char* in_end, T&& in_source ) noexcept( std::is_nothrow_constructible_v< Source, T&& > ) @@ -55,8 +54,7 @@ namespace TAO_PEGTL_NAMESPACE m_current( in_begin ), m_end( in_end ), m_source( std::forward< T >( in_source ) ) - { - } + {} memory_input_base( const memory_input_base& ) = delete; memory_input_base( memory_input_base&& ) = delete; @@ -124,15 +122,6 @@ namespace TAO_PEGTL_NAMESPACE 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; @@ -152,8 +141,7 @@ namespace TAO_PEGTL_NAMESPACE m_current( in_begin.data ), m_end( in_end ), m_source( std::forward< T >( in_source ) ) - { - } + {} template< typename T > memory_input_base( const char* in_begin, const char* in_end, T&& in_source ) noexcept( std::is_nothrow_constructible_v< Source, T&& > ) @@ -161,8 +149,7 @@ namespace TAO_PEGTL_NAMESPACE m_current( in_begin ), m_end( in_end ), m_source( std::forward< T >( in_source ) ) - { - } + {} memory_input_base( const memory_input_base& ) = delete; memory_input_base( memory_input_base&& ) = delete; @@ -219,12 +206,6 @@ namespace TAO_PEGTL_NAMESPACE 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; @@ -253,20 +234,17 @@ namespace TAO_PEGTL_NAMESPACE template< typename T > memory_input( const char* in_begin, const std::size_t in_size, T&& in_source ) noexcept( std::is_nothrow_constructible_v< Source, T&& > ) : memory_input( in_begin, in_begin + in_size, std::forward< T >( in_source ) ) - { - } + {} template< typename T > memory_input( const std::string& in_string, T&& in_source ) noexcept( std::is_nothrow_constructible_v< Source, T&& > ) : memory_input( in_string.data(), in_string.size(), std::forward< T >( in_source ) ) - { - } + {} template< typename T > memory_input( const std::string_view in_string, T&& in_source ) noexcept( std::is_nothrow_constructible_v< Source, T&& > ) : memory_input( in_string.data(), in_string.size(), std::forward< T >( in_source ) ) - { - } + {} template< typename T > memory_input( std::string&&, T&& ) = delete; @@ -274,14 +252,12 @@ namespace TAO_PEGTL_NAMESPACE template< typename T > memory_input( const char* in_begin, T&& in_source ) noexcept( std::is_nothrow_constructible_v< Source, T&& > ) : memory_input( in_begin, std::strlen( in_begin ), std::forward< T >( in_source ) ) - { - } + {} template< typename T > memory_input( const char* in_begin, const char* in_end, T&& in_source, const std::size_t in_byte, const std::size_t in_line, const std::size_t in_byte_in_line ) noexcept( std::is_nothrow_constructible_v< Source, T&& > ) : memory_input( { in_begin, in_byte, in_line, in_byte_in_line }, in_end, std::forward< T >( in_source ) ) - { - } + {} memory_input( const memory_input& ) = delete; memory_input( memory_input&& ) = delete; @@ -326,6 +302,14 @@ namespace TAO_PEGTL_NAMESPACE return this->m_current; } + using internal::memory_input_base< P, Eol, Source >::restart; + + template< rewind_mode M > + void restart( const internal::marker< iterator_t, M >& m ) noexcept + { + iterator() = m.iterator(); + } + using internal::memory_input_base< P, Eol, Source >::position; [[nodiscard]] TAO_PEGTL_NAMESPACE::position position() const @@ -333,13 +317,9 @@ namespace TAO_PEGTL_NAMESPACE return position( iterator() ); } - void discard() const noexcept - { - } + void discard() const noexcept {} - void require( const std::size_t /*unused*/ ) const noexcept - { - } + void require( const std::size_t /*unused*/ ) const noexcept {} template< rewind_mode M > [[nodiscard]] internal::marker< iterator_t, M > mark() noexcept diff --git a/packages/PEGTL/include/tao/pegtl/mmap_input.hpp b/packages/PEGTL/include/tao/pegtl/mmap_input.hpp index b4fd41031..82206dee5 100644 --- a/packages/PEGTL/include/tao/pegtl/mmap_input.hpp +++ b/packages/PEGTL/include/tao/pegtl/mmap_input.hpp @@ -36,8 +36,7 @@ namespace TAO_PEGTL_NAMESPACE explicit mmap_holder( T&& in_filename ) : filename( std::forward< T >( in_filename ) ), data( filename.c_str() ) - { - } + {} mmap_holder( const mmap_holder& ) = delete; mmap_holder( mmap_holder&& ) = delete; @@ -59,8 +58,7 @@ namespace TAO_PEGTL_NAMESPACE explicit mmap_input( T&& in_filename ) : internal::mmap_holder( std::forward< T >( in_filename ) ), memory_input< P, Eol, const char* >( data.begin(), data.end(), filename.c_str() ) - { - } + {} mmap_input( const mmap_input& ) = delete; mmap_input( mmap_input&& ) = delete; diff --git a/packages/PEGTL/include/tao/pegtl/normal.hpp b/packages/PEGTL/include/tao/pegtl/normal.hpp index 02e67c12b..a96d0d0d3 100644 --- a/packages/PEGTL/include/tao/pegtl/normal.hpp +++ b/packages/PEGTL/include/tao/pegtl/normal.hpp @@ -20,20 +20,18 @@ namespace TAO_PEGTL_NAMESPACE { template< typename Rule > - constexpr const char* error_message = nullptr; + inline constexpr const char* error_message = nullptr; template< typename Rule > struct normal { template< typename Input, typename... States > static void start( const Input& /*unused*/, States&&... /*unused*/ ) noexcept - { - } + {} template< typename Input, typename... States > static void success( const Input& /*unused*/, States&&... /*unused*/ ) noexcept - { - } + {} template< typename Input, typename... States > static void failure( const Input& in, States&&... /*unused*/ ) noexcept( error_message< Rule > == nullptr ) @@ -84,12 +82,11 @@ namespace TAO_PEGTL_NAMESPACE typename... States > [[nodiscard]] static bool match( Input& in, States&&... st ) { - constexpr rewind_mode m = ( error_message< Rule > == nullptr ) ? M : rewind_mode::dontcare; - if constexpr( internal::has_match_v< Rule, A, m, Action, Control, Input, States... > ) { - return Action< Rule >::template match< Rule, A, m, Action, Control >( in, st... ); + if constexpr( internal::has_match_v< Rule, A, M, Action, Control, Input, States... > ) { + return Action< Rule >::template match< Rule, A, M, Action, Control >( in, st... ); } else { - return TAO_PEGTL_NAMESPACE::match< Rule, A, m, Action, Control >( in, st... ); + return TAO_PEGTL_NAMESPACE::match< Rule, A, M, Action, Control >( in, st... ); } } }; diff --git a/packages/PEGTL/include/tao/pegtl/nothing.hpp b/packages/PEGTL/include/tao/pegtl/nothing.hpp index d3cbc1e87..6c4b759ce 100644 --- a/packages/PEGTL/include/tao/pegtl/nothing.hpp +++ b/packages/PEGTL/include/tao/pegtl/nothing.hpp @@ -10,8 +10,7 @@ namespace TAO_PEGTL_NAMESPACE { template< typename Rule > struct nothing - { - }; + {}; using maybe_nothing = nothing< void >; diff --git a/packages/PEGTL/include/tao/pegtl/parse_error.hpp b/packages/PEGTL/include/tao/pegtl/parse_error.hpp index 89e70b586..277d4cc2d 100644 --- a/packages/PEGTL/include/tao/pegtl/parse_error.hpp +++ b/packages/PEGTL/include/tao/pegtl/parse_error.hpp @@ -23,15 +23,13 @@ namespace TAO_PEGTL_NAMESPACE parse_error( Msg&& msg, std::vector< position > in_positions ) : std::runtime_error( std::forward< Msg >( msg ) ), positions( std::move( in_positions ) ) - { - } + {} template< typename Msg > parse_error( Msg&& msg, const position& pos ) : std::runtime_error( std::forward< Msg >( msg ) ), positions( 1, pos ) - { - } + {} template< typename Msg > parse_error( Msg&& msg, position&& pos ) @@ -43,8 +41,7 @@ namespace TAO_PEGTL_NAMESPACE template< typename Msg, typename Input > parse_error( Msg&& msg, const Input& in ) : parse_error( std::forward< Msg >( msg ), in.position() ) - { - } + {} std::vector< position > positions; }; diff --git a/packages/PEGTL/include/tao/pegtl/position.hpp b/packages/PEGTL/include/tao/pegtl/position.hpp index 0b5af2565..6cdc07bd0 100644 --- a/packages/PEGTL/include/tao/pegtl/position.hpp +++ b/packages/PEGTL/include/tao/pegtl/position.hpp @@ -25,8 +25,7 @@ namespace TAO_PEGTL_NAMESPACE line( p.line ), byte_in_line( p.byte_in_line ), source( std::move( p.source ) ) - { - } + {} position( const position& ) = default; @@ -47,8 +46,7 @@ namespace TAO_PEGTL_NAMESPACE line( in_iter.line ), byte_in_line( in_iter.byte_in_line ), source( std::forward< T >( in_source ) ) - { - } + {} ~position() = default; diff --git a/packages/PEGTL/include/tao/pegtl/read_input.hpp b/packages/PEGTL/include/tao/pegtl/read_input.hpp index ba2031060..224b2e9a7 100644 --- a/packages/PEGTL/include/tao/pegtl/read_input.hpp +++ b/packages/PEGTL/include/tao/pegtl/read_input.hpp @@ -24,8 +24,7 @@ namespace TAO_PEGTL_NAMESPACE template< typename T > explicit filename_holder( T&& in_filename ) : filename( std::forward< T >( in_filename ) ) - { - } + {} filename_holder( const filename_holder& ) = delete; filename_holder( filename_holder&& ) = delete; @@ -47,15 +46,13 @@ namespace TAO_PEGTL_NAMESPACE explicit read_input( T&& in_filename ) : internal::filename_holder( std::forward< T >( in_filename ) ), string_input< P, Eol, const char* >( internal::file_reader( filename.c_str() ).read(), filename.c_str() ) - { - } + {} template< typename T > read_input( FILE* in_file, T&& in_filename ) : internal::filename_holder( std::forward< T >( in_filename ) ), string_input< P, Eol, const char* >( internal::file_reader( in_file, filename.c_str() ).read(), filename.c_str() ) - { - } + {} read_input( const read_input& ) = delete; read_input( read_input&& ) = delete; diff --git a/packages/PEGTL/include/tao/pegtl/rules.hpp b/packages/PEGTL/include/tao/pegtl/rules.hpp index cd7867061..d1ced0a79 100644 --- a/packages/PEGTL/include/tao/pegtl/rules.hpp +++ b/packages/PEGTL/include/tao/pegtl/rules.hpp @@ -57,8 +57,8 @@ namespace TAO_PEGTL_NAMESPACE template< typename Cond, typename... Rules > struct star_must : internal::star_must< Cond, Rules... > {}; template< typename State, typename... Rules > struct state : internal::state< State, Rules... > {}; struct success : internal::trivial< true > {}; - template< typename... Rules > struct try_catch : internal::try_catch_type< parse_error, Rules... > {}; - template< typename Exception, typename... Rules > struct try_catch_type : internal::try_catch_type< Exception, Rules... > {}; + template< typename... Rules > struct try_catch : internal::seq< internal::try_catch_type< parse_error, Rules... > > {}; + template< typename Exception, typename... Rules > struct try_catch_type : internal::seq< internal::try_catch_type< Exception, Rules... > > {}; template< typename Cond, typename... Rules > struct until : internal::until< Cond, Rules... > {}; // clang-format on diff --git a/packages/PEGTL/include/tao/pegtl/string_input.hpp b/packages/PEGTL/include/tao/pegtl/string_input.hpp index 183058573..06fec70d6 100644 --- a/packages/PEGTL/include/tao/pegtl/string_input.hpp +++ b/packages/PEGTL/include/tao/pegtl/string_input.hpp @@ -23,8 +23,7 @@ namespace TAO_PEGTL_NAMESPACE template< typename T > explicit string_holder( T&& in_data ) : data( std::forward< T >( in_data ) ) - { - } + {} string_holder( const string_holder& ) = delete; string_holder( string_holder&& ) = delete; @@ -46,8 +45,7 @@ namespace TAO_PEGTL_NAMESPACE explicit string_input( V&& in_data, T&& in_source, Ts&&... ts ) : internal::string_holder( std::forward< V >( in_data ) ), memory_input< P, Eol, Source >( data.data(), data.size(), std::forward< T >( in_source ), std::forward< Ts >( ts )... ) - { - } + {} string_input( const string_input& ) = delete; string_input( string_input&& ) = delete; diff --git a/packages/PEGTL/src/example/pegtl/abnf2pegtl.cpp b/packages/PEGTL/src/example/pegtl/abnf2pegtl.cpp index 952399a8a..93d425ce3 100644 --- a/packages/PEGTL/src/example/pegtl/abnf2pegtl.cpp +++ b/packages/PEGTL/src/example/pegtl/abnf2pegtl.cpp @@ -52,7 +52,7 @@ namespace TAO_PEGTL_NAMESPACE "case", "catch", "char", - "char_8t", + "char8_t", "char16_t", "char32_t", "class", @@ -649,7 +649,7 @@ namespace TAO_PEGTL_NAMESPACE // note: content can not be used here! return to_string( n->children.back() ); } - const auto min_element = ( min_val == 1 ) ? content : ( prefix + "rep< " + min + ", " + content + " >" ); + auto min_element = ( min_val == 1 ) ? content : ( prefix + "rep< " + min + ", " + content + " >" ); if( min_val == max_val ) { return min_element; } diff --git a/packages/PEGTL/src/example/pegtl/analyze.cpp b/packages/PEGTL/src/example/pegtl/analyze.cpp index a957cde14..0e4e6416a 100644 --- a/packages/PEGTL/src/example/pegtl/analyze.cpp +++ b/packages/PEGTL/src/example/pegtl/analyze.cpp @@ -10,13 +10,11 @@ struct bar; struct foo : sor< digit, bar > -{ -}; +{}; struct bar : plus< foo > -{ -}; +{}; int main() // NOLINT(bugprone-exception-escape) { diff --git a/packages/PEGTL/src/example/pegtl/chomsky_hierarchy.cpp b/packages/PEGTL/src/example/pegtl/chomsky_hierarchy.cpp index c29d01dcd..1099fcb2d 100644 --- a/packages/PEGTL/src/example/pegtl/chomsky_hierarchy.cpp +++ b/packages/PEGTL/src/example/pegtl/chomsky_hierarchy.cpp @@ -20,8 +20,7 @@ namespace example struct type_3 : pegtl::star< pegtl::one< 'a' >, pegtl::plus< pegtl::one< 'b' > > > - { - }; + {}; // Type 2 - Context Free Languages @@ -31,8 +30,7 @@ namespace example struct type_2_recursive : pegtl::sor< pegtl::string< 'a', 'b' >, pegtl::seq< pegtl::one< 'a' >, type_2_recursive, pegtl::one< 'b' > > > - { - }; + {}; // Implementation that uses state instead of recursion, an // action to set the state, and a custom rule to use it. @@ -65,13 +63,11 @@ namespace example struct type_2_with_state : pegtl::seq< pegtl::star< pegtl::one< 'a' > >, match_n< 'b' > > - { - }; + {}; template< typename Rule > struct action_2_with_state - { - }; + {}; template<> struct action_2_with_state< pegtl::star< pegtl::one< 'a' > > > @@ -93,14 +89,12 @@ namespace example struct type_1 : pegtl::seq< pegtl::star< pegtl::one< 'a' > >, match_n< 'b' >, match_n< 'c' > > - { - }; + {}; template< typename Rule > struct action_1 : action_2_with_state< Rule > - { - }; + {}; // Type 0 - Recursively Enumerable Languages diff --git a/packages/PEGTL/src/example/pegtl/csv1.cpp b/packages/PEGTL/src/example/pegtl/csv1.cpp index 2565607e9..09aed9205 100644 --- a/packages/PEGTL/src/example/pegtl/csv1.cpp +++ b/packages/PEGTL/src/example/pegtl/csv1.cpp @@ -64,8 +64,7 @@ namespace csv1 template< typename Rule > struct control : pegtl::normal< Rule > - { - }; + {}; template<> struct control< value_line > diff --git a/packages/PEGTL/src/example/pegtl/json_build.cpp b/packages/PEGTL/src/example/pegtl/json_build.cpp index 59f5c39a3..f7ea3b9fe 100644 --- a/packages/PEGTL/src/example/pegtl/json_build.cpp +++ b/packages/PEGTL/src/example/pegtl/json_build.cpp @@ -32,8 +32,7 @@ namespace examples template< typename Rule > struct action - { - }; + {}; template<> struct action< pegtl::json::null > diff --git a/packages/PEGTL/src/example/pegtl/json_classes.hpp b/packages/PEGTL/src/example/pegtl/json_classes.hpp index 0d1e9f499..8513ec804 100644 --- a/packages/PEGTL/src/example/pegtl/json_classes.hpp +++ b/packages/PEGTL/src/example/pegtl/json_classes.hpp @@ -27,8 +27,7 @@ namespace examples protected: explicit json_base( const json_type in_type ) : type( in_type ) - { - } + {} virtual ~json_base() = default; @@ -60,8 +59,7 @@ namespace examples { array_json() : json_base( json_type::array ) - { - } + {} std::vector< std::shared_ptr< json_base > > data; @@ -85,8 +83,7 @@ namespace examples explicit boolean_json( const bool in_data ) : json_base( json_type::boolean ), data( in_data ) - { - } + {} bool data; @@ -101,8 +98,7 @@ namespace examples { null_json() : json_base( json_type::null ) - { - } + {} void stream( std::ostream& o ) const override { @@ -116,8 +112,7 @@ namespace examples explicit number_json( const long double in_data ) : json_base( json_type::number ), data( in_data ) - { - } + {} long double data; @@ -181,8 +176,7 @@ namespace examples explicit string_json( const std::string& in_data ) : json_base( json_type::string ), data( in_data ) - { - } + {} std::string data; @@ -197,8 +191,7 @@ namespace examples { object_json() : json_base( json_type::object ) - { - } + {} std::map< std::string, std::shared_ptr< json_base > > data; diff --git a/packages/PEGTL/src/example/pegtl/modulus_match.cpp b/packages/PEGTL/src/example/pegtl/modulus_match.cpp index 131927541..fb484cfd2 100644 --- a/packages/PEGTL/src/example/pegtl/modulus_match.cpp +++ b/packages/PEGTL/src/example/pegtl/modulus_match.cpp @@ -30,8 +30,7 @@ namespace modulus struct grammar : until< eolf, must< my_rule< 3 > > > - { - }; + {}; } // namespace modulus diff --git a/packages/PEGTL/src/test/pegtl/actions_one.cpp b/packages/PEGTL/src/test/pegtl/actions_one.cpp index b86098224..8f370cea5 100644 --- a/packages/PEGTL/src/test/pegtl/actions_one.cpp +++ b/packages/PEGTL/src/test/pegtl/actions_one.cpp @@ -13,17 +13,17 @@ namespace TAO_PEGTL_NAMESPACE namespace test1 { - struct fiz : if_must< at< one< 'a' > >, two< 'a' > > - { - }; + struct fiz + : if_must< at< one< 'a' > >, two< 'a' > > + {}; - struct foo : sor< fiz, one< 'b' > > - { - }; + struct foo + : sor< fiz, one< 'b' > > + {}; - struct bar : until< eof, foo > - { - }; + struct bar + : until< eof, foo > + {}; void test_result() { diff --git a/packages/PEGTL/src/test/pegtl/actions_two.cpp b/packages/PEGTL/src/test/pegtl/actions_two.cpp index 8b29f48c9..b210c33bc 100644 --- a/packages/PEGTL/src/test/pegtl/actions_two.cpp +++ b/packages/PEGTL/src/test/pegtl/actions_two.cpp @@ -24,10 +24,12 @@ namespace TAO_PEGTL_NAMESPACE } }; - struct fobble : sor< state< state1, alpha >, digit > + struct fobble + : sor< state< state1, alpha >, digit > {}; - struct fibble : until< eof, fobble > + struct fibble + : until< eof, fobble > {}; template< typename Rule > diff --git a/packages/PEGTL/src/test/pegtl/contrib_http.cpp b/packages/PEGTL/src/test/pegtl/contrib_http.cpp index a06175ea4..b4f74cd5a 100644 --- a/packages/PEGTL/src/test/pegtl/contrib_http.cpp +++ b/packages/PEGTL/src/test/pegtl/contrib_http.cpp @@ -16,8 +16,7 @@ namespace TAO_PEGTL_NAMESPACE template< typename Rule > struct chunked_action : nothing< Rule > - { - }; + {}; template<> struct chunked_action< http::chunk_ext > diff --git a/packages/PEGTL/src/test/pegtl/contrib_parse_tree.cpp b/packages/PEGTL/src/test/pegtl/contrib_parse_tree.cpp index a4122ba6c..521a8140c 100644 --- a/packages/PEGTL/src/test/pegtl/contrib_parse_tree.cpp +++ b/packages/PEGTL/src/test/pegtl/contrib_parse_tree.cpp @@ -18,8 +18,7 @@ namespace TAO_PEGTL_NAMESPACE template< typename Rule > struct selector : parse_tree::selector< Rule, parse_tree::store_content::on< A, B, C, D > > - { - }; + {}; void unit_test() { diff --git a/packages/PEGTL/src/test/pegtl/contrib_raw_string.cpp b/packages/PEGTL/src/test/pegtl/contrib_raw_string.cpp index d0846222e..872251b1a 100644 --- a/packages/PEGTL/src/test/pegtl/contrib_raw_string.cpp +++ b/packages/PEGTL/src/test/pegtl/contrib_raw_string.cpp @@ -43,13 +43,11 @@ namespace TAO_PEGTL_NAMESPACE struct rgrammar : must< rstring, eof > - { - }; + {}; struct qgrammar : must< qstring, eof > - { - }; + {}; template< typename Rule, template< typename > class Action, unsigned M, unsigned N > void verify_data( const std::size_t line, const char* file, const char ( &m )[ M ], const char ( &n )[ N ] ) diff --git a/packages/PEGTL/src/test/pegtl/data_cstring.cpp b/packages/PEGTL/src/test/pegtl/data_cstring.cpp index 4f6827824..bf8dd4a80 100644 --- a/packages/PEGTL/src/test/pegtl/data_cstring.cpp +++ b/packages/PEGTL/src/test/pegtl/data_cstring.cpp @@ -16,9 +16,9 @@ namespace TAO_PEGTL_NAMESPACE return parse< Rule, Action, Control >( in ); } - struct test_grammar : seq< string< 'a', 'b', 'c', 'd', 'e', 'f' >, not_at< any >, eof > - { - }; + struct test_grammar + : seq< string< 'a', 'b', 'c', 'd', 'e', 'f' >, not_at< any >, eof > + {}; void unit_test() { diff --git a/packages/PEGTL/src/test/pegtl/file_cstream.cpp b/packages/PEGTL/src/test/pegtl/file_cstream.cpp index 09dee3fa6..85d13f443 100644 --- a/packages/PEGTL/src/test/pegtl/file_cstream.cpp +++ b/packages/PEGTL/src/test/pegtl/file_cstream.cpp @@ -8,13 +8,13 @@ namespace TAO_PEGTL_NAMESPACE { - struct file_content : seq< TAO_PEGTL_STRING( "dummy content" ), eol, discard > - { - }; + struct file_content + : seq< TAO_PEGTL_STRING( "dummy content" ), eol, discard > + {}; - struct file_grammar : seq< rep_min_max< 11, 11, file_content >, eof > - { - }; + struct file_grammar + : seq< rep_min_max< 11, 11, file_content >, eof > + {}; void unit_test() { diff --git a/packages/PEGTL/src/test/pegtl/file_istream.cpp b/packages/PEGTL/src/test/pegtl/file_istream.cpp index 17480140a..9b76d071e 100644 --- a/packages/PEGTL/src/test/pegtl/file_istream.cpp +++ b/packages/PEGTL/src/test/pegtl/file_istream.cpp @@ -8,13 +8,13 @@ namespace TAO_PEGTL_NAMESPACE { - struct file_content : seq< TAO_PEGTL_STRING( "dummy content" ), eol, discard > - { - }; + struct file_content + : seq< TAO_PEGTL_STRING( "dummy content" ), eol, discard > + {}; - struct file_grammar : seq< rep_min_max< 11, 11, file_content >, eof > - { - }; + struct file_grammar + : seq< rep_min_max< 11, 11, file_content >, eof > + {}; void unit_test() { diff --git a/packages/PEGTL/src/test/pegtl/file_read.cpp b/packages/PEGTL/src/test/pegtl/file_read.cpp index d074e3336..00b0184ee 100644 --- a/packages/PEGTL/src/test/pegtl/file_read.cpp +++ b/packages/PEGTL/src/test/pegtl/file_read.cpp @@ -12,13 +12,11 @@ namespace TAO_PEGTL_NAMESPACE { explicit open_input( const char* in_filename ) : read_input< P, Eol >( internal::file_open( in_filename ), in_filename ) - { - } + {} explicit open_input( const std::string& in_filename ) : open_input( in_filename.c_str() ) - { - } + {} }; void unit_test() diff --git a/packages/PEGTL/src/test/pegtl/pegtl_string_t.cpp b/packages/PEGTL/src/test/pegtl/pegtl_string_t.cpp index 5b020bcc6..2118e3934 100644 --- a/packages/PEGTL/src/test/pegtl/pegtl_string_t.cpp +++ b/packages/PEGTL/src/test/pegtl/pegtl_string_t.cpp @@ -10,13 +10,13 @@ namespace test { // We only need to test that this compiles... - struct foo : TAO_PEGTL_STRING( "foo" ) - { - }; + struct foo + : TAO_PEGTL_STRING( "foo" ) + {}; - struct foobar : TAO_PEGTL_NAMESPACE::sor< TAO_PEGTL_STRING( "foo" ), TAO_PEGTL_STRING( "bar" ) > - { - }; + struct foobar + : TAO_PEGTL_NAMESPACE::sor< TAO_PEGTL_STRING( "foo" ), TAO_PEGTL_STRING( "bar" ) > + {}; static_assert( std::is_same_v< TAO_PEGTL_STRING( "Hello" ), TAO_PEGTL_NAMESPACE::string< 'H', 'e', 'l', 'l', 'o' > > ); static_assert( !std::is_same_v< TAO_PEGTL_ISTRING( "Hello" ), TAO_PEGTL_NAMESPACE::string< 'H', 'e', 'l', 'l', 'o' > > ); diff --git a/packages/PEGTL/src/test/pegtl/position.cpp b/packages/PEGTL/src/test/pegtl/position.cpp index 6a999ec8a..ff5426d0f 100644 --- a/packages/PEGTL/src/test/pegtl/position.cpp +++ b/packages/PEGTL/src/test/pegtl/position.cpp @@ -12,8 +12,7 @@ namespace TAO_PEGTL_NAMESPACE { buffer_input_t( const std::string& in_string, const std::string& in_source ) : buffer_input< internal::cstring_reader >( in_source, 42, in_string.c_str() ) - { - } + {} }; template< typename Rule, typename Input = memory_input<> > diff --git a/packages/PEGTL/src/test/pegtl/rule_state.cpp b/packages/PEGTL/src/test/pegtl/rule_state.cpp index 52d0de2b1..456f5481c 100644 --- a/packages/PEGTL/src/test/pegtl/rule_state.cpp +++ b/packages/PEGTL/src/test/pegtl/rule_state.cpp @@ -10,13 +10,11 @@ namespace TAO_PEGTL_NAMESPACE { template< typename Input > explicit test_state_state( const Input& /*unused*/ ) - { - } + {} template< typename Input > void success( const Input& /*unused*/ ) const - { - } + {} }; template< typename... Rules > diff --git a/packages/PEGTL/src/test/pegtl/verify_file.hpp b/packages/PEGTL/src/test/pegtl/verify_file.hpp index 15ebe78a1..9e7df26f7 100644 --- a/packages/PEGTL/src/test/pegtl/verify_file.hpp +++ b/packages/PEGTL/src/test/pegtl/verify_file.hpp @@ -10,10 +10,12 @@ namespace TAO_PEGTL_NAMESPACE { - struct file_content : seq< TAO_PEGTL_STRING( "dummy content" ), eol, discard > + struct file_content + : seq< TAO_PEGTL_STRING( "dummy content" ), eol, discard > {}; - struct file_grammar : seq< rep_min_max< 11, 11, file_content >, eof > + struct file_grammar + : seq< rep_min_max< 11, 11, file_content >, eof > {}; template< typename Rule > diff --git a/packages/PEGTL/src/test/pegtl/verify_rule.hpp b/packages/PEGTL/src/test/pegtl/verify_rule.hpp index 2c7b0006c..3efef51c9 100644 --- a/packages/PEGTL/src/test/pegtl/verify_rule.hpp +++ b/packages/PEGTL/src/test/pegtl/verify_rule.hpp @@ -21,8 +21,7 @@ namespace TAO_PEGTL_NAMESPACE { template< typename Input, typename... States > static void apply( const Input& /*unused*/, States&&... /*unused*/ ) - { - } + {} }; template< typename Rule > @@ -30,8 +29,7 @@ namespace TAO_PEGTL_NAMESPACE { template< typename... States > static void apply0( States&&... /*unused*/ ) - { - } + {} }; template< typename Rule, typename Eol = eol::lf_crlf > -- GitLab