diff --git a/doc/Changelog.md b/doc/Changelog.md
index f5447c655..edbb8063a 100644
--- a/doc/Changelog.md
+++ b/doc/Changelog.md
@@ -12,7 +12,7 @@
* Added functions to visit and flatten [nested exceptions](Contrib-and-Examples.md#taopegtlcontribnested_exceptionshpp).
* Added new customization point for error messages.
* Added optional source line output for the tracer.
-* Added new ASCII rules [`cntrl`](Rule-Reference.md#cntrl), [`cr`](Rule-Reference.md#cr), [`esc`](Rule-Reference.md#esc), [`ff`](Rule-Reference.md#ff), [`graph`](Rule-Reference.md#graph), [`ht`](Rule-Reference.md#ht), [`lf`](Rule-Reference.md#lf), [`sp`](Rule-Reference.md#sp), [`vt`](Rule-Reference.md#vt).
+* Added new ASCII rules [`cntrl`](Rule-Reference.md#cntrl), [`cr`](Rule-Reference.md#cr), [`crlf`](Rule-Reference.md#crlf), [`esc`](Rule-Reference.md#esc), [`ff`](Rule-Reference.md#ff), [`graph`](Rule-Reference.md#graph), [`ht`](Rule-Reference.md#ht), [`lf`](Rule-Reference.md#lf), [`lfcr`](Rule-Reference.md#lfcr), [`sp`](Rule-Reference.md#sp), [`vt`](Rule-Reference.md#vt).
* Added new atomic rule [`everything`](Rule-Reference.md#everything).
* Added new convenience rule [`partial`](Rule-Reference.md#partial-r-).
* Added new convenience rule [`star_partial`](Rule-Reference.md#star_partial-r-).
diff --git a/doc/Rule-Reference.md b/doc/Rule-Reference.md
index 91b906ff0..d0191ff26 100644
--- a/doc/Rule-Reference.md
+++ b/doc/Rule-Reference.md
@@ -786,6 +786,11 @@ ASCII rules do not usually rely on other rules.
* Matches and consumes a single ASCII carriage return character of value `13` or `0x0d`.
* [Equivalent] to `one< '\r' >`.
+###### `crlf`
+
+* Matches and consumes the common ASCII carriage return followed by a line feed.
+* [Equivalent] to `string< '\r', '\n' >`.
+
###### `digit`
* Matches and consumes a single ASCII decimal digit character.
@@ -859,6 +864,11 @@ ASCII rules do not usually rely on other rules.
* Matches and consumes a single ASCII line feed (new line) character of value `10` or `0x0a`.
* [Equivalent] to `one< '\n' >`.
+###### `lfcr`
+
+* Matches and consumes an uncommon ASCII line feed followed by a carriage return.
+* [Equivalent] to `string< '\n', '\r' >`.
+
###### `lower`
* Matches and consumes a single ASCII lower-case alphabetic character.
@@ -955,6 +965,7 @@ ASCII rules do not usually rely on other rules.
* [Equivalent] to `seq< one< C >... >`.
* [Meta data] and [implementation] mapping:
- `ascii::string<>::rule_t` is `internal::success`
+ - `ascii::string< C >:rule_t` is `internal::one< result_on_found::success, internal::peek_char, C >`
- `ascii::string< C... >::rule_t` is `internal::string< C... >`
###### `TAO_PEGTL_ISTRING( "..." )`
@@ -1565,6 +1576,7 @@ Binary rules do not rely on other rules.
* [`cntrl`](#cntrl) [(ascii rules)](#ascii-rules)
* [`control< C, R... >`](#control-c-r-) [(meta rules)](#meta-rules)
* [`cr`](#cr) [(ascii rules)](#ascii-rules)
+* [`crlf`](#crlf) [(ascii rules)](#ascii-rules)
* [`dash`](#dash) [(icu rules)](#icu-rules-for-binary-properties)
* [`decomposition_type< V >`](#decomposition_type-v-) [(icu rules)](#icu-rules-for-enumerated-properties)
* [`default_ignorable_code_point`](#default_ignorable_code_point) [(icu rules)](#icu-rules-for-binary-properties)
@@ -1613,6 +1625,7 @@ Binary rules do not rely on other rules.
* [`keyword< C... >`](#keyword-c-) [(ascii rules)](#ascii-rules)
* [`lead_canonical_combining_class< V >`](#lead_canonical_combining_class-v-) [(icu rules)](#icu-rules-for-value-properties)
* [`lf`](#lf) [(ascii rules)](#ascii-rules)
+* [`lfcr`](#lfcr) [(ascii rules)](#ascii-rules)
* [`line_break< V >`](#line_break-v-) [(icu rules)](#icu-rules-for-enumerated-properties)
* [`list< R, S >`](#list-r-s-) [(convenience)](#convenience)
* [`list< R, S, P >`](#list-r-s-p-) [(convenience)](#convenience)
diff --git a/include/tao/pegtl.hpp b/include/tao/pegtl.hpp
index 2ef83e22e..f8f1969c0 100644
--- a/include/tao/pegtl.hpp
+++ b/include/tao/pegtl.hpp
@@ -12,6 +12,7 @@
#include "pegtl/version.hpp"
#include "pegtl/ascii.hpp"
+#include "pegtl/eol.hpp"
#include "pegtl/rules.hpp"
#include "pegtl/utf8.hpp"
diff --git a/include/tao/pegtl/argv_input.hpp b/include/tao/pegtl/argv_input.hpp
index 711a6b221..b94ec5273 100644
--- a/include/tao/pegtl/argv_input.hpp
+++ b/include/tao/pegtl/argv_input.hpp
@@ -28,7 +28,7 @@ namespace TAO_PEGTL_NAMESPACE
} // namespace internal
- template< tracking_mode P = tracking_mode::eager, typename Eol = eol::lf_crlf >
+ template< tracking_mode P = tracking_mode::eager, typename Eol = ascii::lf_crlf >
struct argv_input
: memory_input< P, Eol >
{
diff --git a/include/tao/pegtl/ascii.hpp b/include/tao/pegtl/ascii.hpp
index 0c368f48c..ed4416ad1 100644
--- a/include/tao/pegtl/ascii.hpp
+++ b/include/tao/pegtl/ascii.hpp
@@ -20,7 +20,6 @@ namespace TAO_PEGTL_NAMESPACE
struct any : internal::any< internal::peek_char > {};
struct blank : internal::one< internal::result_on_found::success, internal::peek_char, ' ', '\t' > {};
struct cntrl : internal::ranges< internal::peek_char, static_cast< char >( 0 ), static_cast< char >( 31 ), static_cast< char >( 127 ) > {};
- struct cr : internal::one< internal::result_on_found::success, internal::peek_char, '\r' > {};
struct digit : internal::range< internal::result_on_found::success, internal::peek_char, '0', '9' > {};
struct esc : internal::one< internal::result_on_found::success, internal::peek_char, static_cast< char >( 27 ) > {};
struct ellipsis : internal::string< '.', '.', '.' > {};
@@ -33,7 +32,6 @@ namespace TAO_PEGTL_NAMESPACE
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 > > { static_assert( sizeof...( Cs ) > 0 ); };
- struct lf : internal::one< internal::result_on_found::success, internal::peek_char, '\n' > {};
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 > {};
diff --git a/include/tao/pegtl/buffer_input.hpp b/include/tao/pegtl/buffer_input.hpp
index 2b4489add..fd99b9960 100644
--- a/include/tao/pegtl/buffer_input.hpp
+++ b/include/tao/pegtl/buffer_input.hpp
@@ -33,14 +33,14 @@
namespace TAO_PEGTL_NAMESPACE
{
- template< typename Reader, typename Eol = eol::lf_crlf, typename Source = std::string, std::size_t Chunk = 64 >
+ template< typename Reader, typename Eol = ascii::lf_crlf, typename Source = std::string, std::size_t Chunk = 64 >
class buffer_input
{
public:
using data_t = char;
using reader_t = Reader;
- using eol_t = Eol;
+ using eol_rule = Eol;
using source_t = Source;
using rewind_position_t = internal::large_position;
@@ -126,7 +126,7 @@ namespace TAO_PEGTL_NAMESPACE
void bump( const std::size_t in_count = 1 ) noexcept
{
- internal::bump( m_current, in_count, Eol::ch );
+ internal::bump( m_current, in_count, '\n' );
}
void bump_in_this_line( const std::size_t in_count = 1 ) noexcept
@@ -214,6 +214,23 @@ namespace TAO_PEGTL_NAMESPACE
return static_cast< std::size_t >( m_buffer.get() + m_maximum - m_end );
}
+ template< apply_mode A,
+ rewind_mode M,
+ template< typename... >
+ class Action,
+ template< typename... >
+ class Control,
+ typename ParseInput,
+ typename... States >
+ [[nodiscard]] static bool match_eol( ParseInput& in, States&&... st )
+ {
+ if( Control< typename Eol::rule_t >::template match< A, M, Action, Control >( in, st... ) ) {
+ // in.template consume< eol_consume_tag >( 0 );
+ return true;
+ }
+ return false;
+ }
+
private:
Reader m_reader;
std::size_t m_maximum;
@@ -221,9 +238,6 @@ namespace TAO_PEGTL_NAMESPACE
rewind_position_t m_current;
char* m_end;
const Source m_source;
-
- public:
- std::size_t private_depth = 0;
};
} // namespace TAO_PEGTL_NAMESPACE
diff --git a/include/tao/pegtl/contrib/parse_tree.hpp b/include/tao/pegtl/contrib/parse_tree.hpp
index 04cc2a0f7..bc60f46a0 100644
--- a/include/tao/pegtl/contrib/parse_tree.hpp
+++ b/include/tao/pegtl/contrib/parse_tree.hpp
@@ -21,6 +21,7 @@
#include "../apply_mode.hpp"
#include "../config.hpp"
#include "../demangle.hpp"
+#include "../eol.hpp"
#include "../memory_input.hpp"
#include "../normal.hpp"
#include "../nothing.hpp"
@@ -105,7 +106,7 @@ namespace TAO_PEGTL_NAMESPACE::parse_tree
return { m_begin.data, m_end.data };
}
- template< tracking_mode P = tracking_mode::eager, typename Eol = eol::lf_crlf >
+ template< tracking_mode P = tracking_mode::eager, typename Eol = ascii::lf_crlf >
[[nodiscard]] memory_input< P, Eol > as_memory_input() const
{
assert( has_content() );
diff --git a/include/tao/pegtl/contrib/raw_string.hpp b/include/tao/pegtl/contrib/raw_string.hpp
index e44c20840..245443322 100644
--- a/include/tao/pegtl/contrib/raw_string.hpp
+++ b/include/tao/pegtl/contrib/raw_string.hpp
@@ -27,7 +27,7 @@ namespace TAO_PEGTL_NAMESPACE
using subs_t = empty_list;
template< apply_mode A,
- rewind_mode,
+ rewind_mode M,
template< typename... >
class Action,
template< typename... >
@@ -43,7 +43,7 @@ namespace TAO_PEGTL_NAMESPACE
case Open:
marker_size = i + 1;
in.bump_in_this_line( marker_size );
- (void)eol::match( in );
+ (void)in.template match_eol< A, M, Action, Control >( in );
return true;
case Marker:
break;
diff --git a/include/tao/pegtl/cstream_input.hpp b/include/tao/pegtl/cstream_input.hpp
index 6e003ddb3..0c7c96c63 100644
--- a/include/tao/pegtl/cstream_input.hpp
+++ b/include/tao/pegtl/cstream_input.hpp
@@ -15,7 +15,7 @@
namespace TAO_PEGTL_NAMESPACE
{
- template< typename Eol = eol::lf_crlf, std::size_t Chunk = 64 >
+ template< typename Eol = ascii::lf_crlf, std::size_t Chunk = 64 >
struct cstream_input
: buffer_input< internal::cstream_reader, Eol, std::string, Chunk >
{
diff --git a/include/tao/pegtl/eol.hpp b/include/tao/pegtl/eol.hpp
index aaae30008..8e7b9b5c1 100644
--- a/include/tao/pegtl/eol.hpp
+++ b/include/tao/pegtl/eol.hpp
@@ -1,4 +1,4 @@
-// Copyright (c) 2016-2023 Dr. Colin Hirsch and Daniel Frey
+// Copyright (c) 2014-2023 Dr. Colin Hirsch and Daniel Frey
// Distributed under the Boost Software License, Version 1.0.
// (See accompanying file LICENSE_1_0.txt or copy at https://www.boost.org/LICENSE_1_0.txt)
@@ -7,32 +7,26 @@
#include "config.hpp"
-#include "internal/eol.hpp"
-
-#include "internal/cr_crlf_eol.hpp"
-#include "internal/cr_eol.hpp"
-#include "internal/crlf_eol.hpp"
-#include "internal/lf_crlf_eol.hpp"
-#include "internal/lf_eol.hpp"
+#include "internal/one.hpp"
+#include "internal/peek_char.hpp"
+#include "internal/result_on_found.hpp"
+#include "internal/sor.hpp"
+#include "internal/string.hpp"
namespace TAO_PEGTL_NAMESPACE
{
inline namespace ascii
{
- // Struct eol is both a rule and a pseudo-namespace for the
- // member structs cr, etc. (which are not themselves rules).
-
- struct eol
- : internal::eol
- {
- // clang-format off
- struct cr : internal::cr_eol {};
- struct cr_crlf : internal::cr_crlf_eol {};
- struct crlf : internal::crlf_eol {};
- struct lf : internal::lf_eol {};
- struct lf_crlf : internal::lf_crlf_eol {};
- // clang-format on
- };
+ // clang-format off
+ struct cr : internal::one< internal::result_on_found::success, internal::peek_char, '\r' > {};
+ struct crlf : internal::string< '\r', '\n' > {};
+ struct lf : internal::one< internal::result_on_found::success, internal::peek_char, '\n' > {};
+ struct lfcr : internal::string< '\n', '\r' > {};
+ struct cr_lf : internal::one< internal::result_on_found::success, internal::peek_char, '\r', '\n' > {};
+ struct cr_crlf : internal::sor< internal::string< '\r', '\n' >, internal::one< internal::result_on_found::success, internal::peek_char, '\r' > > {};
+ struct lf_crlf : internal::sor< internal::one< internal::result_on_found::success, internal::peek_char, '\n' >, internal::string< '\r', '\n' > > {};
+ struct cr_lf_crlf : internal::sor< internal::string< '\r', '\n' >, internal::one< internal::result_on_found::success, internal::peek_char, '\r', '\n' > > {};
+ // clang-format on
} // namespace ascii
diff --git a/include/tao/pegtl/file_input.hpp b/include/tao/pegtl/file_input.hpp
index 3eb427056..de9d0d27c 100644
--- a/include/tao/pegtl/file_input.hpp
+++ b/include/tao/pegtl/file_input.hpp
@@ -22,14 +22,14 @@
namespace TAO_PEGTL_NAMESPACE
{
#if defined( _POSIX_MAPPED_FILES ) || defined( _WIN32 )
- template< tracking_mode P = tracking_mode::eager, typename Eol = eol::lf_crlf >
+ template< tracking_mode P = tracking_mode::eager, typename Eol = ascii::lf_crlf >
struct file_input
: mmap_input< P, Eol >
{
using mmap_input< P, Eol >::mmap_input;
};
#else
- template< tracking_mode P = tracking_mode::eager, typename Eol = eol::lf_crlf >
+ template< tracking_mode P = tracking_mode::eager, typename Eol = ascii::lf_crlf >
struct file_input
: read_input< P, Eol >
{
diff --git a/include/tao/pegtl/internal/action_input.hpp b/include/tao/pegtl/internal/action_input.hpp
index a69e5e24e..aa60659a1 100644
--- a/include/tao/pegtl/internal/action_input.hpp
+++ b/include/tao/pegtl/internal/action_input.hpp
@@ -62,11 +62,13 @@ namespace TAO_PEGTL_NAMESPACE::internal
[[nodiscard]] std::string string() const
{
+ static_assert( sizeof( data_t ) == 1 );
return std::string( static_cast< const char* >( m_begin.data ), size() );
}
[[nodiscard]] std::string_view string_view() const noexcept
{
+ static_assert( sizeof( data_t ) == 1 );
return std::string_view( static_cast< const char* >( m_begin.data ), size() );
}
@@ -75,19 +77,26 @@ namespace TAO_PEGTL_NAMESPACE::internal
return m_begin.data[ offset ];
}
+ template< typename T >
+ [[nodiscard]] T peek_as( const std::size_t offset = 0 ) const noexcept
+ {
+ static_assert( sizeof( T ) == sizeof( data_t ) );
+ return static_cast< T >( peek( offset ) );
+ }
+
[[nodiscard]] char peek_char( const std::size_t offset = 0 ) const noexcept
{
- return static_cast< char >( peek( offset ) );
+ return peek_as< char >( offset );
}
[[nodiscard]] std::byte peek_byte( const std::size_t offset = 0 ) const noexcept
{
- return static_cast< std::byte >( peek( offset ) );
+ return peek_as< std::byte >( offset );
}
[[nodiscard]] std::uint8_t peek_uint8( const std::size_t offset = 0 ) const noexcept
{
- return static_cast< std::uint8_t >( peek( offset ) );
+ return peek_as< std::uint8_t >( offset );
}
[[nodiscard]] const ParseInput& input() const noexcept
@@ -95,14 +104,14 @@ namespace TAO_PEGTL_NAMESPACE::internal
return m_input;
}
- [[nodiscard]] const rewind_position_t& rewind_position() const noexcept
+ [[nodiscard]] decltype( auto ) current_position() const
{
- return m_begin;
+ return m_input.previous_position( m_begin ); // NOTE: O(n) with lazy inputs -- n is return value!
}
- [[nodiscard]] decltype( auto ) current_position() const
+ [[nodiscard]] const rewind_position_t& rewind_position() const noexcept
{
- return m_input.previous_position( m_begin ); // NOTE: O(n) with lazy inputs -- n is return value!
+ return m_begin;
}
protected:
diff --git a/include/tao/pegtl/internal/bump_help.hpp b/include/tao/pegtl/internal/bump_help.hpp
index d39df0880..483aa677e 100644
--- a/include/tao/pegtl/internal/bump_help.hpp
+++ b/include/tao/pegtl/internal/bump_help.hpp
@@ -14,7 +14,7 @@ namespace TAO_PEGTL_NAMESPACE::internal
template< typename Rule, typename ParseInput >
void bump_help( ParseInput& in, const std::size_t count )
{
- if constexpr( Rule::test_any( ParseInput::eol_t::ch ) ) {
+ if constexpr( Rule::test_any( '\n' ) ) {
in.bump( count );
}
else {
diff --git a/include/tao/pegtl/internal/cr_crlf_eol.hpp b/include/tao/pegtl/internal/cr_crlf_eol.hpp
deleted file mode 100644
index 00723690b..000000000
--- a/include/tao/pegtl/internal/cr_crlf_eol.hpp
+++ /dev/null
@@ -1,34 +0,0 @@
-// Copyright (c) 2016-2023 Dr. Colin Hirsch and Daniel Frey
-// Distributed under the Boost Software License, Version 1.0.
-// (See accompanying file LICENSE_1_0.txt or copy at https://www.boost.org/LICENSE_1_0.txt)
-
-#ifndef TAO_PEGTL_INTERNAL_CR_CRLF_EOL_HPP
-#define TAO_PEGTL_INTERNAL_CR_CRLF_EOL_HPP
-
-#include "data_and_size.hpp"
-
-#include "../config.hpp"
-
-namespace TAO_PEGTL_NAMESPACE::internal
-{
- struct cr_crlf_eol
- {
- static constexpr int ch = '\r';
-
- template< typename ParseInput >
- [[nodiscard]] static bool_and_size eol_match( ParseInput& in ) noexcept( noexcept( in.size( 2 ) ) )
- {
- bool_and_size p = { false, in.size( 2 ) };
- if( p.size > 0 ) {
- if( in.peek_char() == '\r' ) {
- in.bump_to_next_line( ( p.size = 1 + ( ( p.size > 1 ) && ( in.peek_char( 1 ) == '\n' ) ) ) );
- p.data = true;
- }
- }
- return p;
- }
- };
-
-} // namespace TAO_PEGTL_NAMESPACE::internal
-
-#endif
diff --git a/include/tao/pegtl/internal/cr_eol.hpp b/include/tao/pegtl/internal/cr_eol.hpp
deleted file mode 100644
index 0c42ba006..000000000
--- a/include/tao/pegtl/internal/cr_eol.hpp
+++ /dev/null
@@ -1,34 +0,0 @@
-// Copyright (c) 2016-2023 Dr. Colin Hirsch and Daniel Frey
-// Distributed under the Boost Software License, Version 1.0.
-// (See accompanying file LICENSE_1_0.txt or copy at https://www.boost.org/LICENSE_1_0.txt)
-
-#ifndef TAO_PEGTL_INTERNAL_CR_EOL_HPP
-#define TAO_PEGTL_INTERNAL_CR_EOL_HPP
-
-#include "data_and_size.hpp"
-
-#include "../config.hpp"
-
-namespace TAO_PEGTL_NAMESPACE::internal
-{
- struct cr_eol
- {
- static constexpr int ch = '\r';
-
- template< typename ParseInput >
- [[nodiscard]] static bool_and_size eol_match( ParseInput& in ) noexcept( noexcept( in.size( 1 ) ) )
- {
- bool_and_size p = { false, in.size( 1 ) };
- if( p.size > 0 ) {
- if( in.peek_char() == '\r' ) {
- in.bump_to_next_line();
- p.data = true;
- }
- }
- return p;
- }
- };
-
-} // namespace TAO_PEGTL_NAMESPACE::internal
-
-#endif
diff --git a/include/tao/pegtl/internal/crlf_eol.hpp b/include/tao/pegtl/internal/crlf_eol.hpp
deleted file mode 100644
index c8ea1aa9c..000000000
--- a/include/tao/pegtl/internal/crlf_eol.hpp
+++ /dev/null
@@ -1,34 +0,0 @@
-// Copyright (c) 2016-2023 Dr. Colin Hirsch and Daniel Frey
-// Distributed under the Boost Software License, Version 1.0.
-// (See accompanying file LICENSE_1_0.txt or copy at https://www.boost.org/LICENSE_1_0.txt)
-
-#ifndef TAO_PEGTL_INTERNAL_CRLF_EOL_HPP
-#define TAO_PEGTL_INTERNAL_CRLF_EOL_HPP
-
-#include "data_and_size.hpp"
-
-#include "../config.hpp"
-
-namespace TAO_PEGTL_NAMESPACE::internal
-{
- struct crlf_eol
- {
- static constexpr int ch = '\n';
-
- template< typename ParseInput >
- [[nodiscard]] static bool_and_size eol_match( ParseInput& in ) noexcept( noexcept( in.size( 2 ) ) )
- {
- bool_and_size p = { false, in.size( 2 ) };
- if( p.size > 1 ) {
- if( ( in.peek_char() == '\r' ) && ( in.peek_char( 1 ) == '\n' ) ) {
- in.bump_to_next_line( 2 );
- p.data = true;
- }
- }
- return p;
- }
- };
-
-} // namespace TAO_PEGTL_NAMESPACE::internal
-
-#endif
diff --git a/include/tao/pegtl/internal/eol.hpp b/include/tao/pegtl/internal/eol.hpp
index 7d6542851..c6c6cb3ef 100644
--- a/include/tao/pegtl/internal/eol.hpp
+++ b/include/tao/pegtl/internal/eol.hpp
@@ -5,11 +5,11 @@
#ifndef TAO_PEGTL_INTERNAL_EOL_HPP
#define TAO_PEGTL_INTERNAL_EOL_HPP
-#include "enable_control.hpp"
-
#include "../config.hpp"
#include "../type_list.hpp"
+#include "enable_control.hpp"
+
namespace TAO_PEGTL_NAMESPACE::internal
{
struct eol
@@ -17,10 +17,17 @@ namespace TAO_PEGTL_NAMESPACE::internal
using rule_t = eol;
using subs_t = empty_list;
- template< typename ParseInput >
- [[nodiscard]] static bool match( ParseInput& in ) noexcept( noexcept( ParseInput::eol_t::eol_match( in ) ) )
+ template< apply_mode A,
+ rewind_mode M,
+ template< typename... >
+ class Action,
+ template< typename... >
+ class Control,
+ typename ParseInput,
+ typename... States >
+ [[nodiscard]] static bool match( ParseInput& in, States&&... st )
{
- return ParseInput::eol_t::eol_match( in ).data;
+ return in.template match_eol< A, M, Action, Control >( in, st... );
}
};
diff --git a/include/tao/pegtl/internal/eolf.hpp b/include/tao/pegtl/internal/eolf.hpp
index 01fe64ff0..f78fc0c96 100644
--- a/include/tao/pegtl/internal/eolf.hpp
+++ b/include/tao/pegtl/internal/eolf.hpp
@@ -5,11 +5,11 @@
#ifndef TAO_PEGTL_INTERNAL_EOLF_HPP
#define TAO_PEGTL_INTERNAL_EOLF_HPP
-#include "enable_control.hpp"
-
#include "../config.hpp"
#include "../type_list.hpp"
+#include "enable_control.hpp"
+
namespace TAO_PEGTL_NAMESPACE::internal
{
struct eolf
@@ -17,11 +17,17 @@ namespace TAO_PEGTL_NAMESPACE::internal
using rule_t = eolf;
using subs_t = empty_list;
- template< typename ParseInput >
- [[nodiscard]] static bool match( ParseInput& in ) noexcept( noexcept( ParseInput::eol_t::eol_match( in ) ) )
+ template< apply_mode A,
+ rewind_mode M,
+ template< typename... >
+ class Action,
+ template< typename... >
+ class Control,
+ typename ParseInput,
+ typename... States >
+ [[nodiscard]] static bool match( ParseInput& in, States&&... st )
{
- const auto p = ParseInput::eol_t::eol_match( in );
- return p.data || ( p.size == 0 );
+ return in.empty() || in.template match_eol< A, M, Action, Control >( in, st... );
}
};
diff --git a/include/tao/pegtl/internal/lf_crlf_eol.hpp b/include/tao/pegtl/internal/lf_crlf_eol.hpp
deleted file mode 100644
index aaa40ef7f..000000000
--- a/include/tao/pegtl/internal/lf_crlf_eol.hpp
+++ /dev/null
@@ -1,41 +0,0 @@
-// Copyright (c) 2016-2023 Dr. Colin Hirsch and Daniel Frey
-// Distributed under the Boost Software License, Version 1.0.
-// (See accompanying file LICENSE_1_0.txt or copy at https://www.boost.org/LICENSE_1_0.txt)
-
-#ifndef TAO_PEGTL_INTERNAL_LF_CRLF_EOL_HPP
-#define TAO_PEGTL_INTERNAL_LF_CRLF_EOL_HPP
-
-#include "data_and_size.hpp"
-
-#include "../config.hpp"
-
-namespace TAO_PEGTL_NAMESPACE::internal
-{
- struct lf_crlf_eol
- {
- static constexpr int ch = '\n';
-
- template< typename ParseInput >
- [[nodiscard]] static bool_and_size eol_match( ParseInput& in ) noexcept( noexcept( in.size( 2 ) ) )
- {
- bool_and_size p = { false, in.size( 2 ) };
- if( p.size > 0 ) {
- const auto a = in.peek_char();
- if( a == '\n' ) {
- in.bump_to_next_line();
- p.size = 1;
- p.data = true;
- }
- else if( ( a == '\r' ) && ( p.size > 1 ) && ( in.peek_char( 1 ) == '\n' ) ) {
- in.bump_to_next_line( 2 );
- p.size = 2;
- p.data = true;
- }
- }
- return p;
- }
- };
-
-} // namespace TAO_PEGTL_NAMESPACE::internal
-
-#endif
diff --git a/include/tao/pegtl/internal/lf_eol.hpp b/include/tao/pegtl/internal/lf_eol.hpp
deleted file mode 100644
index 75598d45a..000000000
--- a/include/tao/pegtl/internal/lf_eol.hpp
+++ /dev/null
@@ -1,34 +0,0 @@
-// Copyright (c) 2016-2023 Dr. Colin Hirsch and Daniel Frey
-// Distributed under the Boost Software License, Version 1.0.
-// (See accompanying file LICENSE_1_0.txt or copy at https://www.boost.org/LICENSE_1_0.txt)
-
-#ifndef TAO_PEGTL_INTERNAL_LF_EOL_HPP
-#define TAO_PEGTL_INTERNAL_LF_EOL_HPP
-
-#include "data_and_size.hpp"
-
-#include "../config.hpp"
-
-namespace TAO_PEGTL_NAMESPACE::internal
-{
- struct lf_eol
- {
- static constexpr int ch = '\n';
-
- template< typename ParseInput >
- [[nodiscard]] static bool_and_size eol_match( ParseInput& in ) noexcept( noexcept( in.size( 1 ) ) )
- {
- bool_and_size p = { false, in.size( 1 ) };
- if( p.size > 0 ) {
- if( in.peek_char() == '\n' ) {
- in.bump_to_next_line();
- p.data = true;
- }
- }
- return p;
- }
- };
-
-} // namespace TAO_PEGTL_NAMESPACE::internal
-
-#endif
diff --git a/include/tao/pegtl/internal/rematch.hpp b/include/tao/pegtl/internal/rematch.hpp
index 1ef8df2aa..15ad08fdf 100644
--- a/include/tao/pegtl/internal/rematch.hpp
+++ b/include/tao/pegtl/internal/rematch.hpp
@@ -57,7 +57,7 @@ namespace TAO_PEGTL_NAMESPACE::internal
auto m = in.template make_rewind_guard< rewind_mode::required >();
if( Control< Head >::template match< A, rewind_mode::optional, Action, Control >( in, st... ) ) {
- memory_input< ParseInput::tracking_mode_v, typename ParseInput::eol_t, typename ParseInput::source_t > i2( m.rewind_position(), in.current(), in.source() );
+ memory_input< ParseInput::tracking_mode_v, typename ParseInput::eol_rule, typename ParseInput::source_t > i2( m.rewind_position(), in.current(), in.source() );
return m( ( Control< Rule >::template match< A, rewind_mode::optional, Action, Control >( i2, st... ) && ... && ( i2.rewind_position( m.rewind_position() ), Control< Rules >::template match< A, rewind_mode::optional, Action, Control >( i2, st... ) ) ) );
}
return false;
diff --git a/include/tao/pegtl/internal/rewind_guard.hpp b/include/tao/pegtl/internal/rewind_guard.hpp
index ac2c9dee6..cd04e2cd5 100644
--- a/include/tao/pegtl/internal/rewind_guard.hpp
+++ b/include/tao/pegtl/internal/rewind_guard.hpp
@@ -86,7 +86,7 @@ namespace TAO_PEGTL_NAMESPACE::internal
// using data_t = std::decay_t< std::remove_pointer_t< decltype( std::declval< ParseInput >().end() ) > >;
using rewind_position_t = std::decay_t< decltype( std::declval< ParseInput >().rewind_position() ) >;
- void rewind_restore() noexcept( noexcept( m_input->rewind_position( std::declval< const rewind_position_t& >() ) ) )
+ void rewind_restore() const noexcept
{
m_input->rewind_position( m_saved );
}
diff --git a/include/tao/pegtl/internal/string.hpp b/include/tao/pegtl/internal/string.hpp
index 9fadadaaa..cb9b28250 100644
--- a/include/tao/pegtl/internal/string.hpp
+++ b/include/tao/pegtl/internal/string.hpp
@@ -11,6 +11,7 @@
#include "bump_help.hpp"
#include "enable_control.hpp"
#include "one.hpp"
+#include "peek_char.hpp"
#include "result_on_found.hpp"
#include "success.hpp"
@@ -32,10 +33,10 @@ namespace TAO_PEGTL_NAMESPACE::internal
: success
{};
- // template< char C >
- // struct string
- // : one< C >
- // {};
+ template< char C >
+ struct string< C >
+ : one< result_on_found::success, peek_char, C >
+ {};
template< char... Cs >
struct string
diff --git a/include/tao/pegtl/istream_input.hpp b/include/tao/pegtl/istream_input.hpp
index a020734ce..54697cb56 100644
--- a/include/tao/pegtl/istream_input.hpp
+++ b/include/tao/pegtl/istream_input.hpp
@@ -15,7 +15,7 @@
namespace TAO_PEGTL_NAMESPACE
{
- template< typename Eol = eol::lf_crlf, std::size_t Chunk = 64 >
+ template< typename Eol = ascii::lf_crlf, std::size_t Chunk = 64 >
struct istream_input
: buffer_input< internal::istream_reader, Eol, std::string, Chunk >
{
diff --git a/include/tao/pegtl/line_view_at.hpp b/include/tao/pegtl/line_view_at.hpp
index ce7dcbba4..da9e4a4ac 100644
--- a/include/tao/pegtl/line_view_at.hpp
+++ b/include/tao/pegtl/line_view_at.hpp
@@ -30,7 +30,7 @@ namespace TAO_PEGTL_NAMESPACE
template< typename Input >
[[nodiscard]] const char* end_of_line_or_file( const Input& in, const TAO_PEGTL_NAMESPACE::position& p ) noexcept
{
- using input_t = memory_input< tracking_mode::lazy, typename Input::eol_t, const char* >;
+ using input_t = memory_input< tracking_mode::lazy, typename Input::eol_rule, const char* >;
input_t i2( in.at( p ), in.end(), "" ); // TODO: Start before in.at( p ) to correctly handle the middle of a multi-token EOL.
using grammar = internal::until< internal::at< internal::eolf > >;
(void)normal< grammar >::match< apply_mode::nothing, rewind_mode::optional, nothing, normal >( i2 );
diff --git a/include/tao/pegtl/match.hpp b/include/tao/pegtl/match.hpp
index 712adb2f7..ed49d8bd6 100644
--- a/include/tao/pegtl/match.hpp
+++ b/include/tao/pegtl/match.hpp
@@ -121,19 +121,19 @@ namespace TAO_PEGTL_NAMESPACE
static_assert( !( has_apply && has_apply0 ), "both apply() and apply0() defined" );
constexpr bool is_nothing = std::is_base_of_v< nothing< Rule >, Action< Rule > >;
+
static_assert( !( has_apply && is_nothing ), "unexpected apply() defined" );
static_assert( !( has_apply0 && is_nothing ), "unexpected apply0() defined" );
if constexpr( !has_apply && std::is_base_of_v< require_apply, Action< Rule > > ) {
internal::missing_apply< Control< Rule >, Action >( in, st... );
}
-
if constexpr( !has_apply0 && std::is_base_of_v< require_apply0, Action< Rule > > ) {
internal::missing_apply0< Control< Rule >, Action >( in, st... );
}
-
constexpr bool validate_nothing = std::is_base_of_v< maybe_nothing, Action< void > >;
constexpr bool is_maybe_nothing = std::is_base_of_v< maybe_nothing, Action< Rule > >;
+
static_assert( !enable_action || !validate_nothing || is_nothing || is_maybe_nothing || has_apply || has_apply0, "either apply() or apply0() must be defined" );
constexpr bool use_guard = has_apply || has_apply0_bool;
@@ -141,6 +141,7 @@ namespace TAO_PEGTL_NAMESPACE
auto m = in.template make_rewind_guard< ( use_guard ? rewind_mode::required : rewind_mode::optional ) >();
Control< Rule >::start( static_cast< const ParseInput& >( in ), st... );
auto result = internal::match_control_unwind< Rule, A, ( use_guard ? rewind_mode::optional : M ), Action, Control >( in, st... );
+
if( result ) {
if constexpr( has_apply_void ) {
Control< Rule >::template apply< Action >( m.rewind_position(), static_cast< const ParseInput& >( in ), st... );
@@ -161,8 +162,7 @@ namespace TAO_PEGTL_NAMESPACE
else {
Control< Rule >::failure( static_cast< const ParseInput& >( in ), st... );
}
- (void)m( result );
- return result;
+ return m( result );
}
}
diff --git a/include/tao/pegtl/memory_input.hpp b/include/tao/pegtl/memory_input.hpp
index 70a8b53e2..88a7665fb 100644
--- a/include/tao/pegtl/memory_input.hpp
+++ b/include/tao/pegtl/memory_input.hpp
@@ -24,7 +24,6 @@
#include "internal/action_input.hpp"
#include "internal/at.hpp"
#include "internal/bump.hpp"
-#include "internal/eolf.hpp"
#include "internal/inputerator.hpp"
#include "internal/rewind_guard.hpp"
#include "internal/until.hpp"
@@ -43,7 +42,7 @@ namespace TAO_PEGTL_NAMESPACE
using rewind_position_t = large_position;
template< typename T >
- memory_input_base( const internal::large_position& in_begin, const char* in_end, T&& in_source ) noexcept( std::is_nothrow_constructible_v< Source, T&& > )
+ memory_input_base( const large_position& in_begin, const char* in_end, T&& in_source ) noexcept( std::is_nothrow_constructible_v< Source, T&& > )
: m_begin( in_begin.data ),
m_current( in_begin ),
m_end( in_end ),
@@ -98,7 +97,7 @@ namespace TAO_PEGTL_NAMESPACE
void bump( const std::size_t in_count = 1 ) noexcept
{
- internal::bump( m_current, in_count, Eol::ch );
+ internal::bump( m_current, in_count, '\n' );
}
void bump_in_this_line( const std::size_t in_count = 1 ) noexcept
@@ -202,7 +201,7 @@ namespace TAO_PEGTL_NAMESPACE
[[nodiscard]] position previous_position( const rewind_position_t& it ) const
{
internal::large_position c( m_begin );
- internal::bump( c, static_cast< std::size_t >( it.data - m_begin.data ), Eol::ch );
+ internal::bump( c, static_cast< std::size_t >( it.data - m_begin.data ), '\n' );
return position( c, m_source );
}
@@ -212,7 +211,7 @@ namespace TAO_PEGTL_NAMESPACE
}
protected:
- const internal::large_position m_begin;
+ const large_position m_begin;
small_position m_current;
const char* m_end;
const Source m_source;
@@ -220,19 +219,17 @@ namespace TAO_PEGTL_NAMESPACE
} // namespace internal
- template< tracking_mode P = tracking_mode::eager, typename Eol = eol::lf_crlf, typename Source = std::string >
+ template< tracking_mode P = tracking_mode::eager, typename Eol = ascii::lf_crlf, typename Source = std::string >
class memory_input
: public internal::memory_input_base< P, Eol, Source >
{
public:
static constexpr tracking_mode tracking_mode_v = P;
- using eol_t = Eol;
using data_t = char;
using source_t = Source;
-
+ using eol_rule = Eol;
using typename internal::memory_input_base< P, Eol, Source >::rewind_position_t;
-
using action_t = internal::action_input< memory_input >;
using internal::memory_input_base< P, Eol, Source >::memory_input_base;
@@ -341,6 +338,23 @@ namespace TAO_PEGTL_NAMESPACE
// assert( new_end >= this->m_current );
this->m_end = new_end;
}
+
+ template< apply_mode A,
+ rewind_mode M,
+ template< typename... >
+ class Action,
+ template< typename... >
+ class Control,
+ typename ParseInput,
+ typename... States >
+ [[nodiscard]] static bool match_eol( ParseInput& in, States&&... st )
+ {
+ if( Control< typename Eol::rule_t >::template match< A, M, Action, Control >( in, st... ) ) {
+ // in.template consume< eol_consume_tag >( 0 );
+ return true;
+ }
+ return false;
+ }
};
template< typename... Ts >
diff --git a/include/tao/pegtl/mmap_input.hpp b/include/tao/pegtl/mmap_input.hpp
index 8cff1026d..73445fdab 100644
--- a/include/tao/pegtl/mmap_input.hpp
+++ b/include/tao/pegtl/mmap_input.hpp
@@ -18,7 +18,7 @@
namespace TAO_PEGTL_NAMESPACE
{
- template< tracking_mode P = tracking_mode::eager, typename Eol = eol::lf_crlf >
+ template< tracking_mode P = tracking_mode::eager, typename Eol = ascii::lf_crlf >
struct mmap_input
: private internal::mmap_file,
public memory_input< P, Eol >
diff --git a/include/tao/pegtl/read_input.hpp b/include/tao/pegtl/read_input.hpp
index df7d75651..2b1bd9706 100644
--- a/include/tao/pegtl/read_input.hpp
+++ b/include/tao/pegtl/read_input.hpp
@@ -18,7 +18,7 @@
namespace TAO_PEGTL_NAMESPACE
{
- template< tracking_mode P = tracking_mode::eager, typename Eol = eol::lf_crlf >
+ template< tracking_mode P = tracking_mode::eager, typename Eol = ascii::lf_crlf >
struct read_input
: string_input< P, Eol >
{
diff --git a/include/tao/pegtl/rules.hpp b/include/tao/pegtl/rules.hpp
index beb1088b4..344314dbe 100644
--- a/include/tao/pegtl/rules.hpp
+++ b/include/tao/pegtl/rules.hpp
@@ -28,6 +28,7 @@ namespace TAO_PEGTL_NAMESPACE
struct discard : internal::discard {};
template< typename... Rules > struct enable : internal::enable< Rules... > {};
struct eof : internal::eof {};
+ struct eol : internal::eol {};
struct eolf : internal::eolf {};
struct everything : internal::everything< std::size_t > {};
struct failure : internal::failure {};
diff --git a/include/tao/pegtl/string_input.hpp b/include/tao/pegtl/string_input.hpp
index 91b66bef0..3bfd9fb1c 100644
--- a/include/tao/pegtl/string_input.hpp
+++ b/include/tao/pegtl/string_input.hpp
@@ -37,7 +37,7 @@ namespace TAO_PEGTL_NAMESPACE
} // namespace internal
- template< tracking_mode P = tracking_mode::eager, typename Eol = eol::lf_crlf, typename Source = std::string >
+ template< tracking_mode P = tracking_mode::eager, typename Eol = ascii::lf_crlf, typename Source = std::string >
struct string_input
: private internal::string_holder,
public memory_input< P, Eol, Source >
diff --git a/src/test/pegtl/ascii_classes.cpp b/src/test/pegtl/ascii_classes.cpp
index 22462575d..e93382b21 100644
--- a/src/test/pegtl/ascii_classes.cpp
+++ b/src/test/pegtl/ascii_classes.cpp
@@ -73,6 +73,7 @@ namespace TAO_PEGTL_NAMESPACE
const bool is_blank = ( c == ' ' ) || ( c == '\t' );
const bool is_digit = ( '0' <= c ) && ( c <= '9' );
+ const bool is_odigit = ( '0' <= c ) && ( c <= '7' );
const bool is_cntrl = ( ( 0 <= c ) && ( c <= 31 ) ) || ( c == 127 );
const bool is_lower = ( 'a' <= c ) && ( c <= 'z' );
const bool is_print = ( ( ' ' <= c ) && ( c <= 126 ) );
@@ -104,6 +105,7 @@ namespace TAO_PEGTL_NAMESPACE
verify_char< blank >( __LINE__, __FILE__, c, is_blank );
verify_char< cntrl >( __LINE__, __FILE__, c, is_cntrl );
verify_char< digit >( __LINE__, __FILE__, c, is_digit );
+ verify_char< odigit >( __LINE__, __FILE__, c, is_odigit );
verify_char< eol >( __LINE__, __FILE__, c, is_newline );
verify_char< graph >( __LINE__, __FILE__, c, is_graph );
verify_char< identifier_first >( __LINE__, __FILE__, c, is_ident_first );
@@ -140,6 +142,7 @@ namespace TAO_PEGTL_NAMESPACE
verify_char< blank >( __LINE__, __FILE__, c, false );
verify_char< cntrl >( __LINE__, __FILE__, c, false );
verify_char< digit >( __LINE__, __FILE__, c, false );
+ verify_char< odigit >( __LINE__, __FILE__, c, false );
verify_char< eol >( __LINE__, __FILE__, c, false );
verify_char< graph >( __LINE__, __FILE__, c, false );
verify_char< identifier_first >( __LINE__, __FILE__, c, false );
@@ -162,6 +165,7 @@ namespace TAO_PEGTL_NAMESPACE
verify_char< blank >( __LINE__, __FILE__, c, false );
verify_char< cntrl >( __LINE__, __FILE__, c, false );
verify_char< digit >( __LINE__, __FILE__, c, false );
+ verify_char< odigit >( __LINE__, __FILE__, c, false );
verify_char< eol >( __LINE__, __FILE__, c, false );
verify_char< graph >( __LINE__, __FILE__, c, false );
verify_char< identifier_first >( __LINE__, __FILE__, c, false );
diff --git a/src/test/pegtl/ascii_eol.cpp b/src/test/pegtl/ascii_eol.cpp
index da2364479..b335a4df6 100644
--- a/src/test/pegtl/ascii_eol.cpp
+++ b/src/test/pegtl/ascii_eol.cpp
@@ -18,70 +18,70 @@ namespace TAO_PEGTL_NAMESPACE
for( char i = 1; i < 127; ++i ) {
verify_char< eol >( __LINE__, __FILE__, i, ( i == '\n' ) ? result_type::success : result_type::local_failure );
}
- verify_rule< eol, eol::lf >( __LINE__, __FILE__, " ", result_type::local_failure, 1 );
- verify_rule< eol, eol::lf >( __LINE__, __FILE__, "\r", result_type::local_failure, 1 );
- verify_rule< eol, eol::lf >( __LINE__, __FILE__, "\n", result_type::success, 0 );
- verify_rule< eol, eol::lf >( __LINE__, __FILE__, "\r\n", result_type::local_failure, 2 );
- verify_rule< eol, eol::lf >( __LINE__, __FILE__, "\n\r", result_type::success, 1 );
- verify_rule< eol, eol::lf >( __LINE__, __FILE__, "\n\r\n", result_type::success, 2 );
- verify_rule< eol, eol::lf >( __LINE__, __FILE__, "\n\r\r", result_type::success, 2 );
- verify_rule< eol, eol::lf >( __LINE__, __FILE__, "\na", result_type::success, 1 );
- verify_rule< eol, eol::lf >( __LINE__, __FILE__, "\ra", result_type::local_failure, 2 );
- verify_rule< eol, eol::lf >( __LINE__, __FILE__, "\r\na", result_type::local_failure, 3 );
- verify_rule< eol, eol::lf >( __LINE__, __FILE__, "\r\n\r", result_type::local_failure, 3 );
- verify_rule< eol, eol::lf >( __LINE__, __FILE__, "\r\n\n", result_type::local_failure, 3 );
+ verify_rule< eol, ascii::lf >( __LINE__, __FILE__, " ", result_type::local_failure, 1 );
+ verify_rule< eol, ascii::lf >( __LINE__, __FILE__, "\r", result_type::local_failure, 1 );
+ verify_rule< eol, ascii::lf >( __LINE__, __FILE__, "\n", result_type::success, 0 );
+ verify_rule< eol, ascii::lf >( __LINE__, __FILE__, "\r\n", result_type::local_failure, 2 );
+ verify_rule< eol, ascii::lf >( __LINE__, __FILE__, "\n\r", result_type::success, 1 );
+ verify_rule< eol, ascii::lf >( __LINE__, __FILE__, "\n\r\n", result_type::success, 2 );
+ verify_rule< eol, ascii::lf >( __LINE__, __FILE__, "\n\r\r", result_type::success, 2 );
+ verify_rule< eol, ascii::lf >( __LINE__, __FILE__, "\na", result_type::success, 1 );
+ verify_rule< eol, ascii::lf >( __LINE__, __FILE__, "\ra", result_type::local_failure, 2 );
+ verify_rule< eol, ascii::lf >( __LINE__, __FILE__, "\r\na", result_type::local_failure, 3 );
+ verify_rule< eol, ascii::lf >( __LINE__, __FILE__, "\r\n\r", result_type::local_failure, 3 );
+ verify_rule< eol, ascii::lf >( __LINE__, __FILE__, "\r\n\n", result_type::local_failure, 3 );
- verify_rule< eol, eol::cr >( __LINE__, __FILE__, " ", result_type::local_failure, 1 );
- verify_rule< eol, eol::cr >( __LINE__, __FILE__, "\r", result_type::success, 0 );
- verify_rule< eol, eol::cr >( __LINE__, __FILE__, "\n", result_type::local_failure, 1 );
- verify_rule< eol, eol::cr >( __LINE__, __FILE__, "\r\n", result_type::success, 1 );
- verify_rule< eol, eol::cr >( __LINE__, __FILE__, "\n\r", result_type::local_failure, 2 );
- verify_rule< eol, eol::cr >( __LINE__, __FILE__, "\n\r\n", result_type::local_failure, 3 );
- verify_rule< eol, eol::cr >( __LINE__, __FILE__, "\n\r\r", result_type::local_failure, 3 );
- verify_rule< eol, eol::cr >( __LINE__, __FILE__, "\na", result_type::local_failure, 2 );
- verify_rule< eol, eol::cr >( __LINE__, __FILE__, "\ra", result_type::success, 1 );
- verify_rule< eol, eol::cr >( __LINE__, __FILE__, "\r\na", result_type::success, 2 );
- verify_rule< eol, eol::cr >( __LINE__, __FILE__, "\r\n\r", result_type::success, 2 );
- verify_rule< eol, eol::cr >( __LINE__, __FILE__, "\r\n\n", result_type::success, 2 );
+ verify_rule< eol, ascii::cr >( __LINE__, __FILE__, " ", result_type::local_failure, 1 );
+ verify_rule< eol, ascii::cr >( __LINE__, __FILE__, "\r", result_type::success, 0 );
+ verify_rule< eol, ascii::cr >( __LINE__, __FILE__, "\n", result_type::local_failure, 1 );
+ verify_rule< eol, ascii::cr >( __LINE__, __FILE__, "\r\n", result_type::success, 1 );
+ verify_rule< eol, ascii::cr >( __LINE__, __FILE__, "\n\r", result_type::local_failure, 2 );
+ verify_rule< eol, ascii::cr >( __LINE__, __FILE__, "\n\r\n", result_type::local_failure, 3 );
+ verify_rule< eol, ascii::cr >( __LINE__, __FILE__, "\n\r\r", result_type::local_failure, 3 );
+ verify_rule< eol, ascii::cr >( __LINE__, __FILE__, "\na", result_type::local_failure, 2 );
+ verify_rule< eol, ascii::cr >( __LINE__, __FILE__, "\ra", result_type::success, 1 );
+ verify_rule< eol, ascii::cr >( __LINE__, __FILE__, "\r\na", result_type::success, 2 );
+ verify_rule< eol, ascii::cr >( __LINE__, __FILE__, "\r\n\r", result_type::success, 2 );
+ verify_rule< eol, ascii::cr >( __LINE__, __FILE__, "\r\n\n", result_type::success, 2 );
- verify_rule< eol, eol::crlf >( __LINE__, __FILE__, " ", result_type::local_failure, 1 );
- verify_rule< eol, eol::crlf >( __LINE__, __FILE__, "\r", result_type::local_failure, 1 );
- verify_rule< eol, eol::crlf >( __LINE__, __FILE__, "\n", result_type::local_failure, 1 );
- verify_rule< eol, eol::crlf >( __LINE__, __FILE__, "\r\n", result_type::success, 0 );
- verify_rule< eol, eol::crlf >( __LINE__, __FILE__, "\n\r", result_type::local_failure, 2 );
- verify_rule< eol, eol::crlf >( __LINE__, __FILE__, "\n\r\n", result_type::local_failure, 3 );
- verify_rule< eol, eol::crlf >( __LINE__, __FILE__, "\n\r\r", result_type::local_failure, 3 );
- verify_rule< eol, eol::crlf >( __LINE__, __FILE__, "\na", result_type::local_failure, 2 );
- verify_rule< eol, eol::crlf >( __LINE__, __FILE__, "\ra", result_type::local_failure, 2 );
- verify_rule< eol, eol::crlf >( __LINE__, __FILE__, "\r\na", result_type::success, 1 );
- verify_rule< eol, eol::crlf >( __LINE__, __FILE__, "\r\n\r", result_type::success, 1 );
- verify_rule< eol, eol::crlf >( __LINE__, __FILE__, "\r\n\n", result_type::success, 1 );
+ verify_rule< eol, ascii::crlf >( __LINE__, __FILE__, " ", result_type::local_failure, 1 );
+ verify_rule< eol, ascii::crlf >( __LINE__, __FILE__, "\r", result_type::local_failure, 1 );
+ verify_rule< eol, ascii::crlf >( __LINE__, __FILE__, "\n", result_type::local_failure, 1 );
+ verify_rule< eol, ascii::crlf >( __LINE__, __FILE__, "\r\n", result_type::success, 0 );
+ verify_rule< eol, ascii::crlf >( __LINE__, __FILE__, "\n\r", result_type::local_failure, 2 );
+ verify_rule< eol, ascii::crlf >( __LINE__, __FILE__, "\n\r\n", result_type::local_failure, 3 );
+ verify_rule< eol, ascii::crlf >( __LINE__, __FILE__, "\n\r\r", result_type::local_failure, 3 );
+ verify_rule< eol, ascii::crlf >( __LINE__, __FILE__, "\na", result_type::local_failure, 2 );
+ verify_rule< eol, ascii::crlf >( __LINE__, __FILE__, "\ra", result_type::local_failure, 2 );
+ verify_rule< eol, ascii::crlf >( __LINE__, __FILE__, "\r\na", result_type::success, 1 );
+ verify_rule< eol, ascii::crlf >( __LINE__, __FILE__, "\r\n\r", result_type::success, 1 );
+ verify_rule< eol, ascii::crlf >( __LINE__, __FILE__, "\r\n\n", result_type::success, 1 );
- verify_rule< eol, eol::lf_crlf >( __LINE__, __FILE__, " ", result_type::local_failure, 1 );
- verify_rule< eol, eol::lf_crlf >( __LINE__, __FILE__, "\r", result_type::local_failure, 1 );
- verify_rule< eol, eol::lf_crlf >( __LINE__, __FILE__, "\n", result_type::success, 0 );
- verify_rule< eol, eol::lf_crlf >( __LINE__, __FILE__, "\r\n", result_type::success, 0 );
- verify_rule< eol, eol::lf_crlf >( __LINE__, __FILE__, "\n\r", result_type::success, 1 );
- verify_rule< eol, eol::lf_crlf >( __LINE__, __FILE__, "\n\r\n", result_type::success, 2 );
- verify_rule< eol, eol::lf_crlf >( __LINE__, __FILE__, "\n\r\r", result_type::success, 2 );
- verify_rule< eol, eol::lf_crlf >( __LINE__, __FILE__, "\na", result_type::success, 1 );
- verify_rule< eol, eol::lf_crlf >( __LINE__, __FILE__, "\ra", result_type::local_failure, 2 );
- verify_rule< eol, eol::lf_crlf >( __LINE__, __FILE__, "\r\na", result_type::success, 1 );
- verify_rule< eol, eol::lf_crlf >( __LINE__, __FILE__, "\r\n\r", result_type::success, 1 );
- verify_rule< eol, eol::lf_crlf >( __LINE__, __FILE__, "\r\n\n", result_type::success, 1 );
+ verify_rule< eol, ascii::lf_crlf >( __LINE__, __FILE__, " ", result_type::local_failure, 1 );
+ verify_rule< eol, ascii::lf_crlf >( __LINE__, __FILE__, "\r", result_type::local_failure, 1 );
+ verify_rule< eol, ascii::lf_crlf >( __LINE__, __FILE__, "\n", result_type::success, 0 );
+ verify_rule< eol, ascii::lf_crlf >( __LINE__, __FILE__, "\r\n", result_type::success, 0 );
+ verify_rule< eol, ascii::lf_crlf >( __LINE__, __FILE__, "\n\r", result_type::success, 1 );
+ verify_rule< eol, ascii::lf_crlf >( __LINE__, __FILE__, "\n\r\n", result_type::success, 2 );
+ verify_rule< eol, ascii::lf_crlf >( __LINE__, __FILE__, "\n\r\r", result_type::success, 2 );
+ verify_rule< eol, ascii::lf_crlf >( __LINE__, __FILE__, "\na", result_type::success, 1 );
+ verify_rule< eol, ascii::lf_crlf >( __LINE__, __FILE__, "\ra", result_type::local_failure, 2 );
+ verify_rule< eol, ascii::lf_crlf >( __LINE__, __FILE__, "\r\na", result_type::success, 1 );
+ verify_rule< eol, ascii::lf_crlf >( __LINE__, __FILE__, "\r\n\r", result_type::success, 1 );
+ verify_rule< eol, ascii::lf_crlf >( __LINE__, __FILE__, "\r\n\n", result_type::success, 1 );
- verify_rule< eol, eol::cr_crlf >( __LINE__, __FILE__, " ", result_type::local_failure, 1 );
- verify_rule< eol, eol::cr_crlf >( __LINE__, __FILE__, "\r", result_type::success, 0 );
- verify_rule< eol, eol::cr_crlf >( __LINE__, __FILE__, "\n", result_type::local_failure, 1 );
- verify_rule< eol, eol::cr_crlf >( __LINE__, __FILE__, "\r\n", result_type::success, 0 );
- verify_rule< eol, eol::cr_crlf >( __LINE__, __FILE__, "\n\r", result_type::local_failure, 2 );
- verify_rule< eol, eol::cr_crlf >( __LINE__, __FILE__, "\n\r\n", result_type::local_failure, 3 );
- verify_rule< eol, eol::cr_crlf >( __LINE__, __FILE__, "\n\r\r", result_type::local_failure, 3 );
- verify_rule< eol, eol::cr_crlf >( __LINE__, __FILE__, "\na", result_type::local_failure, 2 );
- verify_rule< eol, eol::cr_crlf >( __LINE__, __FILE__, "\ra", result_type::success, 1 );
- verify_rule< eol, eol::cr_crlf >( __LINE__, __FILE__, "\r\na", result_type::success, 1 );
- verify_rule< eol, eol::cr_crlf >( __LINE__, __FILE__, "\r\n\r", result_type::success, 1 );
- verify_rule< eol, eol::cr_crlf >( __LINE__, __FILE__, "\r\n\n", result_type::success, 1 );
+ verify_rule< eol, ascii::cr_crlf >( __LINE__, __FILE__, " ", result_type::local_failure, 1 );
+ verify_rule< eol, ascii::cr_crlf >( __LINE__, __FILE__, "\r", result_type::success, 0 );
+ verify_rule< eol, ascii::cr_crlf >( __LINE__, __FILE__, "\n", result_type::local_failure, 1 );
+ verify_rule< eol, ascii::cr_crlf >( __LINE__, __FILE__, "\r\n", result_type::success, 0 );
+ verify_rule< eol, ascii::cr_crlf >( __LINE__, __FILE__, "\n\r", result_type::local_failure, 2 );
+ verify_rule< eol, ascii::cr_crlf >( __LINE__, __FILE__, "\n\r\n", result_type::local_failure, 3 );
+ verify_rule< eol, ascii::cr_crlf >( __LINE__, __FILE__, "\n\r\r", result_type::local_failure, 3 );
+ verify_rule< eol, ascii::cr_crlf >( __LINE__, __FILE__, "\na", result_type::local_failure, 2 );
+ verify_rule< eol, ascii::cr_crlf >( __LINE__, __FILE__, "\ra", result_type::success, 1 );
+ verify_rule< eol, ascii::cr_crlf >( __LINE__, __FILE__, "\r\na", result_type::success, 1 );
+ verify_rule< eol, ascii::cr_crlf >( __LINE__, __FILE__, "\r\n\r", result_type::success, 1 );
+ verify_rule< eol, ascii::cr_crlf >( __LINE__, __FILE__, "\r\n\n", result_type::success, 1 );
}
} // namespace TAO_PEGTL_NAMESPACE
diff --git a/src/test/pegtl/ascii_eolf.cpp b/src/test/pegtl/ascii_eolf.cpp
index 32bb28018..89be07dfe 100644
--- a/src/test/pegtl/ascii_eolf.cpp
+++ b/src/test/pegtl/ascii_eolf.cpp
@@ -18,70 +18,70 @@ namespace TAO_PEGTL_NAMESPACE
for( char i = 1; i < 127; ++i ) {
verify_char< eolf >( __LINE__, __FILE__, i, ( i == '\n' ) ? result_type::success : result_type::local_failure );
}
- verify_rule< eolf, eol::lf >( __LINE__, __FILE__, " ", result_type::local_failure, 1 );
- verify_rule< eolf, eol::lf >( __LINE__, __FILE__, "\r", result_type::local_failure, 1 );
- verify_rule< eolf, eol::lf >( __LINE__, __FILE__, "\n", result_type::success, 0 );
- verify_rule< eolf, eol::lf >( __LINE__, __FILE__, "\r\n", result_type::local_failure, 2 );
- verify_rule< eolf, eol::lf >( __LINE__, __FILE__, "\n\r", result_type::success, 1 );
- verify_rule< eolf, eol::lf >( __LINE__, __FILE__, "\n\r\n", result_type::success, 2 );
- verify_rule< eolf, eol::lf >( __LINE__, __FILE__, "\n\r\r", result_type::success, 2 );
- verify_rule< eolf, eol::lf >( __LINE__, __FILE__, "\na", result_type::success, 1 );
- verify_rule< eolf, eol::lf >( __LINE__, __FILE__, "\ra", result_type::local_failure, 2 );
- verify_rule< eolf, eol::lf >( __LINE__, __FILE__, "\r\na", result_type::local_failure, 3 );
- verify_rule< eolf, eol::lf >( __LINE__, __FILE__, "\r\n\r", result_type::local_failure, 3 );
- verify_rule< eolf, eol::lf >( __LINE__, __FILE__, "\r\n\n", result_type::local_failure, 3 );
+ verify_rule< eolf, ascii::lf >( __LINE__, __FILE__, " ", result_type::local_failure, 1 );
+ verify_rule< eolf, ascii::lf >( __LINE__, __FILE__, "\r", result_type::local_failure, 1 );
+ verify_rule< eolf, ascii::lf >( __LINE__, __FILE__, "\n", result_type::success, 0 );
+ verify_rule< eolf, ascii::lf >( __LINE__, __FILE__, "\r\n", result_type::local_failure, 2 );
+ verify_rule< eolf, ascii::lf >( __LINE__, __FILE__, "\n\r", result_type::success, 1 );
+ verify_rule< eolf, ascii::lf >( __LINE__, __FILE__, "\n\r\n", result_type::success, 2 );
+ verify_rule< eolf, ascii::lf >( __LINE__, __FILE__, "\n\r\r", result_type::success, 2 );
+ verify_rule< eolf, ascii::lf >( __LINE__, __FILE__, "\na", result_type::success, 1 );
+ verify_rule< eolf, ascii::lf >( __LINE__, __FILE__, "\ra", result_type::local_failure, 2 );
+ verify_rule< eolf, ascii::lf >( __LINE__, __FILE__, "\r\na", result_type::local_failure, 3 );
+ verify_rule< eolf, ascii::lf >( __LINE__, __FILE__, "\r\n\r", result_type::local_failure, 3 );
+ verify_rule< eolf, ascii::lf >( __LINE__, __FILE__, "\r\n\n", result_type::local_failure, 3 );
- verify_rule< eolf, eol::cr >( __LINE__, __FILE__, " ", result_type::local_failure, 1 );
- verify_rule< eolf, eol::cr >( __LINE__, __FILE__, "\r", result_type::success, 0 );
- verify_rule< eolf, eol::cr >( __LINE__, __FILE__, "\n", result_type::local_failure, 1 );
- verify_rule< eolf, eol::cr >( __LINE__, __FILE__, "\r\n", result_type::success, 1 );
- verify_rule< eolf, eol::cr >( __LINE__, __FILE__, "\n\r", result_type::local_failure, 2 );
- verify_rule< eolf, eol::cr >( __LINE__, __FILE__, "\n\r\n", result_type::local_failure, 3 );
- verify_rule< eolf, eol::cr >( __LINE__, __FILE__, "\n\r\r", result_type::local_failure, 3 );
- verify_rule< eolf, eol::cr >( __LINE__, __FILE__, "\na", result_type::local_failure, 2 );
- verify_rule< eolf, eol::cr >( __LINE__, __FILE__, "\ra", result_type::success, 1 );
- verify_rule< eolf, eol::cr >( __LINE__, __FILE__, "\r\na", result_type::success, 2 );
- verify_rule< eolf, eol::cr >( __LINE__, __FILE__, "\r\n\r", result_type::success, 2 );
- verify_rule< eolf, eol::cr >( __LINE__, __FILE__, "\r\n\n", result_type::success, 2 );
+ verify_rule< eolf, ascii::cr >( __LINE__, __FILE__, " ", result_type::local_failure, 1 );
+ verify_rule< eolf, ascii::cr >( __LINE__, __FILE__, "\r", result_type::success, 0 );
+ verify_rule< eolf, ascii::cr >( __LINE__, __FILE__, "\n", result_type::local_failure, 1 );
+ verify_rule< eolf, ascii::cr >( __LINE__, __FILE__, "\r\n", result_type::success, 1 );
+ verify_rule< eolf, ascii::cr >( __LINE__, __FILE__, "\n\r", result_type::local_failure, 2 );
+ verify_rule< eolf, ascii::cr >( __LINE__, __FILE__, "\n\r\n", result_type::local_failure, 3 );
+ verify_rule< eolf, ascii::cr >( __LINE__, __FILE__, "\n\r\r", result_type::local_failure, 3 );
+ verify_rule< eolf, ascii::cr >( __LINE__, __FILE__, "\na", result_type::local_failure, 2 );
+ verify_rule< eolf, ascii::cr >( __LINE__, __FILE__, "\ra", result_type::success, 1 );
+ verify_rule< eolf, ascii::cr >( __LINE__, __FILE__, "\r\na", result_type::success, 2 );
+ verify_rule< eolf, ascii::cr >( __LINE__, __FILE__, "\r\n\r", result_type::success, 2 );
+ verify_rule< eolf, ascii::cr >( __LINE__, __FILE__, "\r\n\n", result_type::success, 2 );
- verify_rule< eolf, eol::crlf >( __LINE__, __FILE__, " ", result_type::local_failure, 1 );
- verify_rule< eolf, eol::crlf >( __LINE__, __FILE__, "\r", result_type::local_failure, 1 );
- verify_rule< eolf, eol::crlf >( __LINE__, __FILE__, "\n", result_type::local_failure, 1 );
- verify_rule< eolf, eol::crlf >( __LINE__, __FILE__, "\r\n", result_type::success, 0 );
- verify_rule< eolf, eol::crlf >( __LINE__, __FILE__, "\n\r", result_type::local_failure, 2 );
- verify_rule< eolf, eol::crlf >( __LINE__, __FILE__, "\n\r\n", result_type::local_failure, 3 );
- verify_rule< eolf, eol::crlf >( __LINE__, __FILE__, "\n\r\r", result_type::local_failure, 3 );
- verify_rule< eolf, eol::crlf >( __LINE__, __FILE__, "\na", result_type::local_failure, 2 );
- verify_rule< eolf, eol::crlf >( __LINE__, __FILE__, "\ra", result_type::local_failure, 2 );
- verify_rule< eolf, eol::crlf >( __LINE__, __FILE__, "\r\na", result_type::success, 1 );
- verify_rule< eolf, eol::crlf >( __LINE__, __FILE__, "\r\n\r", result_type::success, 1 );
- verify_rule< eolf, eol::crlf >( __LINE__, __FILE__, "\r\n\n", result_type::success, 1 );
+ verify_rule< eolf, ascii::crlf >( __LINE__, __FILE__, " ", result_type::local_failure, 1 );
+ verify_rule< eolf, ascii::crlf >( __LINE__, __FILE__, "\r", result_type::local_failure, 1 );
+ verify_rule< eolf, ascii::crlf >( __LINE__, __FILE__, "\n", result_type::local_failure, 1 );
+ verify_rule< eolf, ascii::crlf >( __LINE__, __FILE__, "\r\n", result_type::success, 0 );
+ verify_rule< eolf, ascii::crlf >( __LINE__, __FILE__, "\n\r", result_type::local_failure, 2 );
+ verify_rule< eolf, ascii::crlf >( __LINE__, __FILE__, "\n\r\n", result_type::local_failure, 3 );
+ verify_rule< eolf, ascii::crlf >( __LINE__, __FILE__, "\n\r\r", result_type::local_failure, 3 );
+ verify_rule< eolf, ascii::crlf >( __LINE__, __FILE__, "\na", result_type::local_failure, 2 );
+ verify_rule< eolf, ascii::crlf >( __LINE__, __FILE__, "\ra", result_type::local_failure, 2 );
+ verify_rule< eolf, ascii::crlf >( __LINE__, __FILE__, "\r\na", result_type::success, 1 );
+ verify_rule< eolf, ascii::crlf >( __LINE__, __FILE__, "\r\n\r", result_type::success, 1 );
+ verify_rule< eolf, ascii::crlf >( __LINE__, __FILE__, "\r\n\n", result_type::success, 1 );
- verify_rule< eolf, eol::lf_crlf >( __LINE__, __FILE__, " ", result_type::local_failure, 1 );
- verify_rule< eolf, eol::lf_crlf >( __LINE__, __FILE__, "\r", result_type::local_failure, 1 );
- verify_rule< eolf, eol::lf_crlf >( __LINE__, __FILE__, "\n", result_type::success, 0 );
- verify_rule< eolf, eol::lf_crlf >( __LINE__, __FILE__, "\r\n", result_type::success, 0 );
- verify_rule< eolf, eol::lf_crlf >( __LINE__, __FILE__, "\n\r", result_type::success, 1 );
- verify_rule< eolf, eol::lf_crlf >( __LINE__, __FILE__, "\n\r\n", result_type::success, 2 );
- verify_rule< eolf, eol::lf_crlf >( __LINE__, __FILE__, "\n\r\r", result_type::success, 2 );
- verify_rule< eolf, eol::lf_crlf >( __LINE__, __FILE__, "\na", result_type::success, 1 );
- verify_rule< eolf, eol::lf_crlf >( __LINE__, __FILE__, "\ra", result_type::local_failure, 2 );
- verify_rule< eolf, eol::lf_crlf >( __LINE__, __FILE__, "\r\na", result_type::success, 1 );
- verify_rule< eolf, eol::lf_crlf >( __LINE__, __FILE__, "\r\n\r", result_type::success, 1 );
- verify_rule< eolf, eol::lf_crlf >( __LINE__, __FILE__, "\r\n\n", result_type::success, 1 );
+ verify_rule< eolf, ascii::lf_crlf >( __LINE__, __FILE__, " ", result_type::local_failure, 1 );
+ verify_rule< eolf, ascii::lf_crlf >( __LINE__, __FILE__, "\r", result_type::local_failure, 1 );
+ verify_rule< eolf, ascii::lf_crlf >( __LINE__, __FILE__, "\n", result_type::success, 0 );
+ verify_rule< eolf, ascii::lf_crlf >( __LINE__, __FILE__, "\r\n", result_type::success, 0 );
+ verify_rule< eolf, ascii::lf_crlf >( __LINE__, __FILE__, "\n\r", result_type::success, 1 );
+ verify_rule< eolf, ascii::lf_crlf >( __LINE__, __FILE__, "\n\r\n", result_type::success, 2 );
+ verify_rule< eolf, ascii::lf_crlf >( __LINE__, __FILE__, "\n\r\r", result_type::success, 2 );
+ verify_rule< eolf, ascii::lf_crlf >( __LINE__, __FILE__, "\na", result_type::success, 1 );
+ verify_rule< eolf, ascii::lf_crlf >( __LINE__, __FILE__, "\ra", result_type::local_failure, 2 );
+ verify_rule< eolf, ascii::lf_crlf >( __LINE__, __FILE__, "\r\na", result_type::success, 1 );
+ verify_rule< eolf, ascii::lf_crlf >( __LINE__, __FILE__, "\r\n\r", result_type::success, 1 );
+ verify_rule< eolf, ascii::lf_crlf >( __LINE__, __FILE__, "\r\n\n", result_type::success, 1 );
- verify_rule< eolf, eol::cr_crlf >( __LINE__, __FILE__, " ", result_type::local_failure, 1 );
- verify_rule< eolf, eol::cr_crlf >( __LINE__, __FILE__, "\r", result_type::success, 0 );
- verify_rule< eolf, eol::cr_crlf >( __LINE__, __FILE__, "\n", result_type::local_failure, 1 );
- verify_rule< eolf, eol::cr_crlf >( __LINE__, __FILE__, "\r\n", result_type::success, 0 );
- verify_rule< eolf, eol::cr_crlf >( __LINE__, __FILE__, "\n\r", result_type::local_failure, 2 );
- verify_rule< eolf, eol::cr_crlf >( __LINE__, __FILE__, "\n\r\n", result_type::local_failure, 3 );
- verify_rule< eolf, eol::cr_crlf >( __LINE__, __FILE__, "\n\r\r", result_type::local_failure, 3 );
- verify_rule< eolf, eol::cr_crlf >( __LINE__, __FILE__, "\na", result_type::local_failure, 2 );
- verify_rule< eolf, eol::cr_crlf >( __LINE__, __FILE__, "\ra", result_type::success, 1 );
- verify_rule< eolf, eol::cr_crlf >( __LINE__, __FILE__, "\r\na", result_type::success, 1 );
- verify_rule< eolf, eol::cr_crlf >( __LINE__, __FILE__, "\r\n\r", result_type::success, 1 );
- verify_rule< eolf, eol::cr_crlf >( __LINE__, __FILE__, "\r\n\n", result_type::success, 1 );
+ verify_rule< eolf, ascii::cr_crlf >( __LINE__, __FILE__, " ", result_type::local_failure, 1 );
+ verify_rule< eolf, ascii::cr_crlf >( __LINE__, __FILE__, "\r", result_type::success, 0 );
+ verify_rule< eolf, ascii::cr_crlf >( __LINE__, __FILE__, "\n", result_type::local_failure, 1 );
+ verify_rule< eolf, ascii::cr_crlf >( __LINE__, __FILE__, "\r\n", result_type::success, 0 );
+ verify_rule< eolf, ascii::cr_crlf >( __LINE__, __FILE__, "\n\r", result_type::local_failure, 2 );
+ verify_rule< eolf, ascii::cr_crlf >( __LINE__, __FILE__, "\n\r\n", result_type::local_failure, 3 );
+ verify_rule< eolf, ascii::cr_crlf >( __LINE__, __FILE__, "\n\r\r", result_type::local_failure, 3 );
+ verify_rule< eolf, ascii::cr_crlf >( __LINE__, __FILE__, "\na", result_type::local_failure, 2 );
+ verify_rule< eolf, ascii::cr_crlf >( __LINE__, __FILE__, "\ra", result_type::success, 1 );
+ verify_rule< eolf, ascii::cr_crlf >( __LINE__, __FILE__, "\r\na", result_type::success, 1 );
+ verify_rule< eolf, ascii::cr_crlf >( __LINE__, __FILE__, "\r\n\r", result_type::success, 1 );
+ verify_rule< eolf, ascii::cr_crlf >( __LINE__, __FILE__, "\r\n\n", result_type::success, 1 );
}
} // namespace TAO_PEGTL_NAMESPACE
diff --git a/src/test/pegtl/discard_input.cpp b/src/test/pegtl/discard_input.cpp
index 3e8a39187..80669dc05 100644
--- a/src/test/pegtl/discard_input.cpp
+++ b/src/test/pegtl/discard_input.cpp
@@ -13,7 +13,7 @@ namespace TAO_PEGTL_NAMESPACE
template< typename Rule, template< typename... > class Action >
bool parse_cstring( const char* string, const char* source, const std::size_t maximum )
{
- buffer_input< internal::cstring_reader, eol::lf_crlf, const char*, 1 > in( source, maximum, string );
+ buffer_input< internal::cstring_reader, ascii::lf_crlf, const char*, 1 > in( source, maximum, string );
return parse< Rule, Action >( in );
}
diff --git a/src/test/pegtl/file_read.cpp b/src/test/pegtl/file_read.cpp
index 4bce4f2ac..af5ef1c6c 100644
--- a/src/test/pegtl/file_read.cpp
+++ b/src/test/pegtl/file_read.cpp
@@ -7,7 +7,7 @@
namespace TAO_PEGTL_NAMESPACE
{
- template< tracking_mode P = tracking_mode::eager, typename Eol = eol::lf_crlf >
+ template< tracking_mode P = tracking_mode::eager, typename Eol = ascii::lf_crlf >
struct open_input
: public read_input< P, Eol >
{
diff --git a/src/test/pegtl/restart_input.cpp b/src/test/pegtl/restart_input.cpp
index a8b5a1221..103d049f1 100644
--- a/src/test/pegtl/restart_input.cpp
+++ b/src/test/pegtl/restart_input.cpp
@@ -11,7 +11,7 @@ namespace TAO_PEGTL_NAMESPACE
void test_lazy()
{
const std::string data = "abc";
- memory_input< tracking_mode::lazy, eol::lf_crlf, std::string > in( data, __FUNCTION__ );
+ memory_input< tracking_mode::lazy, ascii::lf_crlf, std::string > in( data, __FUNCTION__ );
bool success = parse< grammar >( in );
TAO_PEGTL_TEST_ASSERT( success );
in.restart();
@@ -22,7 +22,7 @@ namespace TAO_PEGTL_NAMESPACE
void test_eager()
{
const std::string data = "abc";
- memory_input< tracking_mode::eager, eol::lf_crlf, std::string > in( std::string_view{ data }, __FUNCTION__ );
+ memory_input< tracking_mode::eager, ascii::lf_crlf, std::string > in( std::string_view{ data }, __FUNCTION__ );
bool success = parse< grammar >( in );
TAO_PEGTL_TEST_ASSERT( success );
in.restart();
diff --git a/src/test/pegtl/verify_rule.hpp b/src/test/pegtl/verify_rule.hpp
index e952a8377..56e9c5f2f 100644
--- a/src/test/pegtl/verify_rule.hpp
+++ b/src/test/pegtl/verify_rule.hpp
@@ -8,7 +8,6 @@
#include
#include
-#include
#include
#include
#include
@@ -34,7 +33,7 @@ namespace TAO_PEGTL_NAMESPACE
{}
};
- template< typename Rule, typename Eol = eol::lf_crlf >
+ template< typename Rule, typename Eol = ascii::lf_crlf >
void verify_rule( const std::size_t line, const char* file, const std::string& data, const result_type expected, int remain = -1 )
{
if( remain < 0 ) {
@@ -60,7 +59,7 @@ namespace TAO_PEGTL_NAMESPACE
}
}
- template< typename Rule, typename Eol = eol::lf_crlf >
+ template< typename Rule, typename Eol = ascii::lf_crlf >
void verify_only( const std::size_t line, const char* file, const std::string& data, const result_type expected, const std::size_t remain )
{
{