Skip to content

Commit

Permalink
Some style fixes.
Browse files Browse the repository at this point in the history
  • Loading branch information
ColinH committed Apr 18, 2024
1 parent 34b9cc6 commit 82176db
Show file tree
Hide file tree
Showing 26 changed files with 44 additions and 120 deletions.
1 change: 1 addition & 0 deletions include/tao/pegtl/buffer/endless_reader.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@
#ifndef TAO_PEGTL_BUFFER_ENDLESS_READER_HPP
#define TAO_PEGTL_BUFFER_ENDLESS_READER_HPP

#include <cassert>
#include <cstddef>
#include <cstring>
#include <string>
Expand Down
2 changes: 1 addition & 1 deletion include/tao/pegtl/contrib/rep_string.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ namespace TAO_PEGTL_NAMESPACE
template< char... Ss, char... Cs >
struct make_rep_string< 0, ascii_string< Ss... >, Cs... >
{
using type = string< Ss... >;
using type = ascii_string< Ss... >;
};

template< std::size_t N, char... Ss, char... Cs >
Expand Down
2 changes: 1 addition & 1 deletion include/tao/pegtl/debug/coverage.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@ namespace TAO_PEGTL_NAMESPACE

[[nodiscard]] explicit operator bool() const noexcept
{
return start || success || failure || unwind || raise || raise_nested;
return ( start != 0 ) || ( success != 0 ) || ( failure != 0 ) || ( unwind != 0 ) || ( raise != 0 ) || ( raise_nested != 0 );
}
};

Expand Down
5 changes: 3 additions & 2 deletions include/tao/pegtl/debug/trace_action.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -2,15 +2,16 @@
// 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_DEBUG_TRACE_HPP
#define TAO_PEGTL_DEBUG_TRACE_HPP
#ifndef TAO_PEGTL_DEBUG_TRACE_ACTION_HPP
#define TAO_PEGTL_DEBUG_TRACE_ACTION_HPP

#include <iostream>
#include <tuple>
#include <type_traits>

#include "../apply_mode.hpp"
#include "../config.hpp"
#include "../match.hpp"
#include "../nothing.hpp"
#include "../rewind_mode.hpp"

Expand Down
2 changes: 2 additions & 0 deletions include/tao/pegtl/debug/trace_traits.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,8 @@
#include <cstddef>
#include <string_view>

#include "../normal.hpp"

namespace TAO_PEGTL_NAMESPACE
{
template< bool HideInternal = true,
Expand Down
2 changes: 2 additions & 0 deletions include/tao/pegtl/internal/action_input.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,8 @@ namespace TAO_PEGTL_NAMESPACE::internal
action_input_impl( action_input_impl&& ) = delete;
action_input_impl( const action_input_impl& ) = delete;

~action_input_impl() = default;

void operator=( action_input_impl&& ) = delete;
void operator=( const action_input_impl& ) = delete;

Expand Down
2 changes: 2 additions & 0 deletions include/tao/pegtl/internal/dummy_guard.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,8 @@ namespace TAO_PEGTL_NAMESPACE::internal
dummy_guard( dummy_guard&& ) = delete;
dummy_guard( const dummy_guard& ) = delete;

~dummy_guard() = default;

void operator=( dummy_guard&& ) = delete;
void operator=( const dummy_guard& ) = delete;

Expand Down
2 changes: 1 addition & 1 deletion include/tao/pegtl/internal/ione.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ namespace TAO_PEGTL_NAMESPACE::internal
template< typename Data >
[[nodiscard]] static constexpr bool test( const Data c ) noexcept
{
return ( ascii_ichar_equal< Cs >( c ) || ... ) == true;
return ( ascii_ichar_equal< Cs >( c ) || ... );
}
};

Expand Down
2 changes: 1 addition & 1 deletion include/tao/pegtl/internal/lazy_scan_traits.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ namespace TAO_PEGTL_NAMESPACE::internal
pos.column = 1;
continue;
}
else if( const auto pair = Peek::peek( in ) ) {
if( const auto pair = Peek::peek( in ) ) {
pos.column += pair.size();
in.template consume< void >( pair.size() );
continue;
Expand Down
2 changes: 2 additions & 0 deletions include/tao/pegtl/internal/mmap_input.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,8 @@
#include <filesystem>

#include "../config.hpp"
#include "../count_position.hpp"
#include "../pointer_position.hpp"

#include "mmap_file_base.hpp"
#include "view_input.hpp"
Expand Down
2 changes: 1 addition & 1 deletion include/tao/pegtl/internal/not_ione.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ namespace TAO_PEGTL_NAMESPACE::internal
{
using data_t = typename Peek::data_t;
static_assert( sizeof( Data ) <= sizeof( data_t ) );
return ( ascii_ichar_equal< Cs >( c ) || ... ) == false;
return !( ascii_ichar_equal< Cs >( c ) || ... );
}
};

Expand Down
2 changes: 1 addition & 1 deletion include/tao/pegtl/internal/not_one.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ namespace TAO_PEGTL_NAMESPACE::internal
{
using data_t = typename Peek::data_t;
static_assert( sizeof( Data ) <= sizeof( data_t ) );
return ( ( data_t( c ) == Cs ) || ... ) == false;
return !( ( data_t( c ) == Cs ) || ... );
}
};

Expand Down
2 changes: 1 addition & 1 deletion include/tao/pegtl/internal/not_range.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ namespace TAO_PEGTL_NAMESPACE::internal
{
using data_t = typename Peek::data_t;
static_assert( sizeof( Data ) <= sizeof( data_t ) );
return ( ( Lo <= data_t( c ) ) && ( data_t( c ) <= Hi ) ) == false;
return ( Lo > data_t( c ) ) || ( data_t( c ) > Hi );
}
};

Expand Down
6 changes: 3 additions & 3 deletions include/tao/pegtl/internal/peek_seven.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -41,12 +41,12 @@ namespace TAO_PEGTL_NAMESPACE::internal
static_assert( sizeof( data_t ) == sizeof( raw_t ) );

if( in.size( 1 + offset ) >= ( 1 + offset ) ) {
const data_t c = static_cast< data_t >( *in.current( offset ) );
const auto c = static_cast< data_t >( *in.current( offset ) );
if( is_seven_value( c ) ) {
return pair_t( c, 1 );
return { c, 1 };
}
}
return pair_t();
return {};
}
};

Expand Down
2 changes: 1 addition & 1 deletion include/tao/pegtl/internal/rematch_position.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@
namespace TAO_PEGTL_NAMESPACE::internal
{
template< typename Guard, typename Input, typename Data >
[[nodiscard]] auto rematch_position( Guard&, Input& in, const pointer_position< Data > saved )
[[nodiscard]] auto rematch_position( Guard& /*unused*/, Input& in, const pointer_position< Data > saved )
{
return in.previous_position( saved );
}
Expand Down
3 changes: 3 additions & 0 deletions include/tao/pegtl/internal/unicode_string.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,9 @@

#include <cstddef>

#include "../apply_mode.hpp"
#include "../config.hpp"
#include "../rewind_mode.hpp"
#include "../type_list.hpp"

#include "dependent_false.hpp"
Expand All @@ -16,6 +18,7 @@
#include "peek_unicode.hpp"
#include "peek_utf16.hpp"
#include "peek_utf32.hpp"
#include "seq.hpp"
#include "success.hpp"
#include "utf32_to_utf8.hpp"

Expand Down
10 changes: 5 additions & 5 deletions include/tao/pegtl/internal/utf16_decode.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -22,20 +22,20 @@ namespace TAO_PEGTL_NAMESPACE::internal
const std::size_t size = in.size( s + s + offset );

if( size >= ( offset + s ) ) {
const char16_t t = Endian::template get< char16_t >( in.current( offset ) );
const auto t = Endian::template get< char16_t >( in.current( offset ) );
if( !is_utf16_surrogate( t ) ) {
return char32_and_size( t, s );
return { t, s };
}
if( is_utf16_high_surrogate( t ) ) {
if( size >= ( offset + s + s ) ) {
const char16_t u = Endian::template get< char16_t >( in.current( offset + s ) );
const auto u = Endian::template get< char16_t >( in.current( offset + s ) );
if( is_utf16_low_surrogate( u ) ) {
return char32_and_size( utf16_compose( t, u ), s + s );
return { utf16_compose( t, u ), s + s };
}
}
}
}
return char32_and_size();
return {};
}

} // namespace TAO_PEGTL_NAMESPACE::internal
Expand Down
4 changes: 2 additions & 2 deletions include/tao/pegtl/internal/utf32_decode.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -24,10 +24,10 @@ namespace TAO_PEGTL_NAMESPACE::internal
const char32_t t = Endian::template get< char32_t >( in.current( offset ) );

if( is_utf32( t ) ) {
return char32_and_size( t, s );
return { t, s };
}
}
return char32_and_size();
return {};
}

} // namespace TAO_PEGTL_NAMESPACE::internal
Expand Down
10 changes: 5 additions & 5 deletions include/tao/pegtl/internal/utf8_decode.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -25,15 +25,15 @@ namespace TAO_PEGTL_NAMESPACE::internal
if( size >= ( offset + 1 ) ) {
const char32_t c0 = integer_adapt< std::uint8_t >( in.current( offset ) );
if( is_utf8_byte_1_of_1( c0 ) ) {
return char32_and_size( c0, 1 );
return { c0, 1 };
}
if( is_utf8_byte_1_of_2( c0 ) ) {
if( size >= ( offset + 2 ) ) {
const char32_t c1 = integer_adapt< std::uint8_t >( in.current( offset + 1 ) );
if( is_utf8_continuation( c1 ) ) {
const char32_t c = utf8_compose( c0, c1 );
if( c >= 0x80 ) {
return char32_and_size( c, 2 );
return { c, 2 };
}
}
}
Expand All @@ -45,7 +45,7 @@ namespace TAO_PEGTL_NAMESPACE::internal
if( is_utf8_continuation( c1 ) && is_utf8_continuation( c2 ) ) {
const char32_t c = utf8_compose( c0, c1, c2 );
if( ( c >= 0x800 ) && ( !is_utf16_surrogate( c ) ) ) {
return char32_and_size( c, 3 );
return { c, 3 };
}
}
}
Expand All @@ -58,13 +58,13 @@ namespace TAO_PEGTL_NAMESPACE::internal
if( is_utf8_continuation( c1 ) && is_utf8_continuation( c2 ) && is_utf8_continuation( c3 ) ) {
const char32_t c = utf8_compose( c0, c1, c2, c3 );
if( ( c >= 0x10000 ) && ( c <= 0x10ffff ) ) {
return char32_and_size( c, 4 );
return { c, 4 };
}
}
}
}
}
return char32_and_size();
return {};
}

} // namespace TAO_PEGTL_NAMESPACE::internal
Expand Down
1 change: 1 addition & 0 deletions include/tao/pegtl/member.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@

#include "internal/peek_member.hpp"
#include "internal/rules.hpp"
#include "internal/using.hpp"

namespace TAO_PEGTL_NAMESPACE::member
{
Expand Down
90 changes: 0 additions & 90 deletions src/example/pegtl/cst.cpp

This file was deleted.

2 changes: 1 addition & 1 deletion src/example/pegtl/token_input_1.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@

#include <tao/pegtl/debug/analyze_traits.hpp>

enum my_type
enum class my_type
{
alpha,
beta,
Expand Down
2 changes: 1 addition & 1 deletion src/example/pegtl/token_input_2.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@
#include <tao/pegtl.hpp>
#include <tao/pegtl/member.hpp>

enum my_type
enum class my_type
{
alpha,
beta,
Expand Down
2 changes: 1 addition & 1 deletion src/test/pegtl/icu_utf16_base.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
#include "verify_meta.hpp"
#include "verify_rule.hpp"

#include <tao/pegtl/icu/utf16.hpp>
// #include <tao/pegtl/icu/utf16.hpp>

namespace TAO_PEGTL_NAMESPACE
{
Expand Down
2 changes: 1 addition & 1 deletion src/test/pegtl/icu_utf32_base.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
#include "verify_meta.hpp"
#include "verify_rule.hpp"

#include <tao/pegtl/icu/utf32.hpp>
// #include <tao/pegtl/icu/utf32.hpp>

namespace TAO_PEGTL_NAMESPACE
{
Expand Down
2 changes: 1 addition & 1 deletion src/test/pegtl/icu_utf8_base.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
#include "verify_meta.hpp"
#include "verify_rule.hpp"

#include <tao/pegtl/icu/utf8.hpp>
// #include <tao/pegtl/icu/utf8.hpp>

namespace TAO_PEGTL_NAMESPACE
{
Expand Down

0 comments on commit 82176db

Please sign in to comment.