Skip to content

Commit

Permalink
Avoid convenience macro to improve compile-time
Browse files Browse the repository at this point in the history
  • Loading branch information
d-frey committed Jan 1, 2018
1 parent 50ccba5 commit 3ffb14b
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 11 deletions.
16 changes: 8 additions & 8 deletions include/tao/pegtl/contrib/http.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -58,7 +58,7 @@ namespace tao
struct status_code : rep< 3, abnf::DIGIT > {};
struct reason_phrase : star< sor< abnf::VCHAR, obs_text, abnf::WSP > > {};

struct HTTP_version : if_must< TAOCPP_PEGTL_STRING( "HTTP/" ), abnf::DIGIT, one< '.' >, abnf::DIGIT > {};
struct HTTP_version : if_must< string< 'H', 'T', 'T', 'P', '/' >, abnf::DIGIT, one< '.' >, abnf::DIGIT > {};

struct request_line : if_must< method, abnf::SP, request_target, abnf::SP, HTTP_version, abnf::CRLF > {};
struct status_line : if_must< HTTP_version, abnf::SP, status_code, abnf::SP, reason_phrase, abnf::CRLF > {};
Expand All @@ -82,17 +82,17 @@ namespace tao

struct transfer_parameter : seq< token, BWS, one< '=' >, BWS, sor< token, quoted_string > > {};
struct transfer_extension : seq< token, star< OWS, one< ';' >, OWS, transfer_parameter > > {};
struct transfer_coding : sor< TAOCPP_PEGTL_ISTRING( "chunked" ),
TAOCPP_PEGTL_ISTRING( "compress" ),
TAOCPP_PEGTL_ISTRING( "deflate" ),
TAOCPP_PEGTL_ISTRING( "gzip" ),
struct transfer_coding : sor< istring< 'c', 'h', 'u', 'n', 'k', 'e', 'd' >,
istring< 'c', 'o', 'm', 'p', 'r', 'e', 's', 's' >,
istring< 'd', 'e', 'f', 'l', 'a', 't', 'e' >,
istring< 'g', 'z', 'i', 'p' >,
transfer_extension > {};

struct rank : sor< seq< one< '0' >, opt< one< '.' >, rep_opt< 3, abnf::DIGIT > > >,
seq< one< '1' >, opt< one< '.' >, rep_opt< 3, one< '0' > > > > > {};

struct t_ranking : seq< OWS, one< ';' >, OWS, one< 'q', 'Q' >, one< '=' >, rank > {};
struct t_codings : sor< TAOCPP_PEGTL_ISTRING( "trailers" ), seq< transfer_coding, opt< t_ranking > > > {};
struct t_codings : sor< istring< 't', 'r', 'a', 'i', 'l', 'e', 'r', 's' >, seq< transfer_coding, opt< t_ranking > > > {};

struct TE : opt< sor< one< ',' >, t_codings >, star< OWS, one< ',' >, opt< OWS, t_codings > > > {};

Expand Down Expand Up @@ -120,8 +120,8 @@ namespace tao

struct Via : make_comma_list< seq< received_protocol, RWS, received_by, opt< RWS, comment > > > {};

struct http_URI : if_must< TAOCPP_PEGTL_ISTRING( "http://" ), uri::authority, uri::path_abempty, uri::opt_query, uri::opt_fragment > {};
struct https_URI : if_must< TAOCPP_PEGTL_ISTRING( "https://" ), uri::authority, uri::path_abempty, uri::opt_query, uri::opt_fragment > {};
struct http_URI : if_must< istring< 'h', 't', 't', 'p', ':', '/', '/' >, uri::authority, uri::path_abempty, uri::opt_query, uri::opt_fragment > {};
struct https_URI : if_must< istring< 'h', 't', 't', 'p', 's', ':', '/', '/' >, uri::authority, uri::path_abempty, uri::opt_query, uri::opt_fragment > {};

struct partial_URI : seq< uri::relative_part, uri::opt_query > {};

Expand Down
6 changes: 3 additions & 3 deletions include/tao/pegtl/contrib/json.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -32,9 +32,9 @@ namespace tao
struct name_separator : pad< one< ':' >, ws > {};
struct value_separator : padr< one< ',' > > {};

struct false_ : TAOCPP_PEGTL_STRING( "false" ) {};
struct null : TAOCPP_PEGTL_STRING( "null" ) {};
struct true_ : TAOCPP_PEGTL_STRING( "true" ) {};
struct false_ : string< 'f', 'a', 'l', 's', 'e' > {};
struct null : string< 'n', 'u', 'l', 'l' > {};
struct true_ : string< 't', 'r', 'u', 'e' > {};

struct digits : plus< abnf::DIGIT > {};
struct exp : seq< one< 'e', 'E' >, opt< one< '-', '+'> >, must< digits > > {};
Expand Down

0 comments on commit 3ffb14b

Please sign in to comment.