From d9964d079af1d2ed557ab87d97829fec31cbac9b Mon Sep 17 00:00:00 2001 From: "Dr. Colin Hirsch" Date: Thu, 17 Dec 2020 12:49:08 +0100 Subject: [PATCH] Update. --- doc/Changelog.md | 6 +++--- doc/Inputs-and-Parsing.md | 14 +++++++++++++- 2 files changed, 16 insertions(+), 4 deletions(-) diff --git a/doc/Changelog.md b/doc/Changelog.md index b44ffb905..3241c64f8 100644 --- a/doc/Changelog.md +++ b/doc/Changelog.md @@ -4,13 +4,13 @@ Released: 2020-12-17 -* Added some experimental and undocumented `contrib` features. -* Added `test()` and `can_match_eol` members to pertinent rules. * Made `analyze()` more verbose by default to aid finding the rule cycles. +* Added `parse_nested()` overload that accepts a `position` as first argument. +* Added some experimental and undocumented `contrib` features and their infrastructure. * Improved CMake support for [``](Installing-and-Using.md#filesystem) fallbacks and alternatives. * Re-enabled support for GCC 7. * Automatically link with `libstdc++fs` or `libc++fs` as needed. - * Added automatic fallback from `std::filesystem` to `std::experimental::filesystem` as needed. + * Added automatic fallback from `std::filesystem` to `std::experimental::filesystem`. * Added manual fallback from `std::filesystem` to `boost::filesystem`. * Thank you [Beman Dawes](https://isocpp.org/blog/2020/12/remembering-beman-dawes)! * Converted continuous integration infrastructure to GitHub Actions. diff --git a/doc/Inputs-and-Parsing.md b/doc/Inputs-and-Parsing.md index 2f00c8661..786d5b312 100644 --- a/doc/Inputs-and-Parsing.md +++ b/doc/Inputs-and-Parsing.md @@ -312,7 +312,7 @@ Nested parsing refers to an (inner) parsing run that is performed "in the middle The difference to the regular `tao::pegtl::parse()` function is that `tao::pegtl::parse_nested()` takes care of adding to the `std::vector` of `tao::pegtl::position` objects in the exception class `tao::pegtl::parse_error`. This allows generating error messages of the form "error in file F1 line L1 included from file F2 line L2...". -Calling `parse_nested()` requires one additional argument compared to `parse()`, the input from the outer parsing run as first argument. +Compared to `parse()`, calling `parse_nested()` requires either the input from the outer parsing run or the position as additional first argument. Everything else remains the same. ```c++ @@ -327,6 +327,18 @@ template< typename Rule, bool parse_nested( const OuterInput& oi, ParseInput& in, States&&... st ); + +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, + typename OuterInput, + typename ParseInput, + typename... States > +bool parse_nested( position op, + ParseInput& in, + States&&... st ); ``` ## Incremental Input