Skip to content

Commit

Permalink
Fix clang-tidy.
Browse files Browse the repository at this point in the history
  • Loading branch information
ColinH committed Sep 22, 2023
1 parent d09bb1c commit 3c6e0e0
Show file tree
Hide file tree
Showing 3 changed files with 45 additions and 31 deletions.
10 changes: 5 additions & 5 deletions src/example/pegtl/expression.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,7 @@ namespace TAO_PEGTL_NAMESPACE::expression
{
struct prefix_info
{
prefix_info( const std::string_view n, const unsigned pbp ) noexcept
prefix_info( const std::string_view n, const unsigned pbp )
: name( n ),
prefix_binding_power( pbp )
{
Expand All @@ -59,11 +59,11 @@ namespace TAO_PEGTL_NAMESPACE::expression

struct infix_postfix_info
{
infix_postfix_info( const std::string_view n, const unsigned lbp, const unsigned rbp = 0 ) noexcept
infix_postfix_info( const std::string_view n, const unsigned lbp, const unsigned rbp = 0 )
: infix_postfix_info( n, std::string_view(), lbp, rbp )
{}

infix_postfix_info( const std::string_view n, const std::string_view o, const unsigned lbp, const unsigned rbp = 0 ) noexcept
infix_postfix_info( const std::string_view n, const std::string_view o, const unsigned lbp, const unsigned rbp = 0 )
: name( n ),
other( o ),
left_binding_power( lbp ),
Expand Down Expand Up @@ -434,12 +434,12 @@ namespace application
{
assert( string_stack.size() > args );

std::string tmp = *( string_stack.end() - args - 1 ) + std::string( op ) + " ";
std::string tmp = *( string_stack.end() - int( args ) - 1 ) + std::string( op ) + " ";
for( std::size_t i = 0; i < args; ++i ) {
if( i > 0 ) {
tmp += ", ";
}
tmp += *( string_stack.end() - args + i );
tmp += *( string_stack.end() - int( args ) + int( i ) );
}
tmp += " " + std::string( o2 );
string_stack.resize( string_stack.size() - args );
Expand Down
33 changes: 20 additions & 13 deletions src/example/pegtl/iri.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -12,11 +12,12 @@ int main()
}
#else

#include <iostream>
#include <stdexcept>

#include <tao/pegtl.hpp>
#include <tao/pegtl/contrib/iri.hpp>

#include <iostream>

namespace pegtl = TAO_PEGTL_NAMESPACE;

struct IRI
Expand Down Expand Up @@ -84,17 +85,23 @@ IRI::IRI( const std::string& iri )

int main( int argc, char** argv )
{
for( int i = 1; i < argc; ++i ) {
std::cout << "Parsing " << argv[ i ] << std::endl;
const IRI iri( argv[ i ] );
std::cout << "IRI.scheme: " << iri.scheme << std::endl;
std::cout << "IRI.authority: " << iri.authority << std::endl;
std::cout << "IRI.userinfo: " << iri.userinfo << std::endl;
std::cout << "IRI.host: " << iri.host << std::endl;
std::cout << "IRI.port: " << iri.port << std::endl;
std::cout << "IRI.path: " << iri.path << std::endl;
std::cout << "IRI.query: " << iri.query << std::endl;
std::cout << "IRI.fragment: " << iri.fragment << std::endl;
try {
for( int i = 1; i < argc; ++i ) {
std::cout << "Parsing " << argv[ i ] << std::endl;
const IRI iri( argv[ i ] );
std::cout << "IRI.scheme: " << iri.scheme << std::endl;
std::cout << "IRI.authority: " << iri.authority << std::endl;
std::cout << "IRI.userinfo: " << iri.userinfo << std::endl;
std::cout << "IRI.host: " << iri.host << std::endl;
std::cout << "IRI.port: " << iri.port << std::endl;
std::cout << "IRI.path: " << iri.path << std::endl;
std::cout << "IRI.query: " << iri.query << std::endl;
std::cout << "IRI.fragment: " << iri.fragment << std::endl;
}
}
catch( const std::exception& e ) {
std::cerr << "error: " << e.what() << std::endl;
return 1;
}
return 0;
}
Expand Down
33 changes: 20 additions & 13 deletions src/example/pegtl/uri.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -11,11 +11,12 @@ int main()
}
#else

#include <iostream>
#include <stdexcept>

#include <tao/pegtl.hpp>
#include <tao/pegtl/contrib/uri.hpp>

#include <iostream>

namespace pegtl = TAO_PEGTL_NAMESPACE;

struct URI
Expand Down Expand Up @@ -83,17 +84,23 @@ URI::URI( const std::string& uri )

int main( int argc, char** argv )
{
for( int i = 1; i < argc; ++i ) {
std::cout << "Parsing " << argv[ i ] << std::endl;
const URI uri( argv[ i ] );
std::cout << "URI.scheme: " << uri.scheme << std::endl;
std::cout << "URI.authority: " << uri.authority << std::endl;
std::cout << "URI.userinfo: " << uri.userinfo << std::endl;
std::cout << "URI.host: " << uri.host << std::endl;
std::cout << "URI.port: " << uri.port << std::endl;
std::cout << "URI.path: " << uri.path << std::endl;
std::cout << "URI.query: " << uri.query << std::endl;
std::cout << "URI.fragment: " << uri.fragment << std::endl;
try {
for( int i = 1; i < argc; ++i ) {
std::cout << "Parsing " << argv[ i ] << std::endl;
const URI uri( argv[ i ] );
std::cout << "URI.scheme: " << uri.scheme << std::endl;
std::cout << "URI.authority: " << uri.authority << std::endl;
std::cout << "URI.userinfo: " << uri.userinfo << std::endl;
std::cout << "URI.host: " << uri.host << std::endl;
std::cout << "URI.port: " << uri.port << std::endl;
std::cout << "URI.path: " << uri.path << std::endl;
std::cout << "URI.query: " << uri.query << std::endl;
std::cout << "URI.fragment: " << uri.fragment << std::endl;
}
}
catch( const std::exception& e ) {
std::cerr << "error: " << e.what() << std::endl;
return 1;
}
return 0;
}
Expand Down

0 comments on commit 3c6e0e0

Please sign in to comment.